java - Extract list of objects from WSDL XML with XPath -
i have following xml:
<?xml version="1.0" encoding="utf-8"?> <dataset xmlns="http://mrcs/"> <xs:schema id="estacoes" xmlns="" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="estacoes" msdata:isdataset="true" msdata:usecurrentlocale="true"> <xs:complextype> <xs:choice minoccurs="0" maxoccurs="unbounded"> <xs:element name="table"> <xs:complextype> <xs:sequence> <xs:element name="nomeestacao" type="xs:string" minoccurs="0"/> <xs:element name="codestacao" type="xs:string" minoccurs="0"/> <xs:element name="bacia" type="xs:string" minoccurs="0"/> <xs:element name="subbacia" type="xs:decimal" minoccurs="0"/> <xs:element name="operadora" type="xs:string" minoccurs="0"/> <xs:element name="responsavel" type="xs:string" minoccurs="0"/> <xs:element name="municipio-uf" type="xs:string" minoccurs="0"/> <xs:element name="latitude" type="xs:decimal" minoccurs="0"/> <xs:element name="longitude" type="xs:decimal" minoccurs="0"/> <xs:element name="altitude" type="xs:decimal" minoccurs="0"/> <xs:element name="codrio" type="xs:decimal" minoccurs="0"/> <xs:element name="nomerio" type="xs:string" minoccurs="0"/> <xs:element name="origem" type="xs:string" minoccurs="0"/> <xs:element name="statusestacao" type="xs:string" minoccurs="0"/> </xs:sequence> </xs:complextype> </xs:element> </xs:choice> </xs:complextype> </xs:element> </xs:schema> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <estacoes xmlns=""> <table diffgr:id="table1" msdata:roworder="0"> <nomeestacao>guarapuava - colÉgio agricola</nomeestacao> <codestacao>02551010</codestacao> <bacia>6</bacia> <subbacia>65</subbacia> <operadora>00067 - iapar - iapar</operadora> <responsavel>00067 - iapar - iapar</responsavel> <municipio-uf>guarapuava-pr</municipio-uf> <latitude>-25.36470</latitude> <longitude>-51.49690</longitude> <altitude>1045.00</altitude> <codrio>0</codrio> <nomerio/> <origem>ana/sivam</origem> <statusestacao>ativo</statusestacao> </table> </estacoes> </diffgr:diffgram> </dataset>
from want extract <table>
element. if use xpath(/*) can entire document, can't figure out way extract elements it. possible use xpath wsdl xmls?
edit: using postgresql xpath function query xml column
instead of handling quite complex issue various namespaces on document can select table
element xpath expression
xpath(/*/*/*/table)
it selects table
elements on every fourth level.
Comments
Post a Comment