xpath - Querying XML content within an element -
i have odd xml document have query. weather.gov output. information i'd query within under: /enelope/body/ndfdgenresponse/dwmlout. converted form of xml. possible query individual elements under value, or have post process query within it? suspicion i'll have post process.
<?xml version="1.0" encoding="iso-8859-1"?> <soap-env:envelope soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"> <soap-env:body> <ns1:ndfdgenresponse xmlns:ns1="http://graphical.weather.gov/xml/dwmlgen/wsdl/ndfdxml.wsdl"> <dwmlout xsi:type="xsd:string"><?xml version="1.0"?> <dwml version="1.0" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="http://graphical.weather.gov/xml/dwmlgen/schema/dwml.xsd"> <head> <product srsname="wgs 1984" concise-name="glance" operational-mode="official"> <title>noaa's national weather service forecast @ glance</title> <field>meteorological</field> <category>forecast</category> <creation-date refresh-frequency="pt1h">2012-06-26t19:09:06z</creation-date> </product> <source> <more-information>http://graphical.weather.gov/xml/</more-information> <production-center>meteorological development laboratory<sub-center>product generation branch</sub-center></production-center> <disclaimer>http://www.nws.noaa.gov/disclaimer.html</disclaimer> <credit>http://www.weather.gov/</credit> <credit-logo>http://www.weather.gov/images/xml_logo.gif</credit-logo> <feedback>http://www.weather.gov/feedback.php</feedback> </source> </head> <data> <location> ..... </conditions-icon> </parameters> </data> </dwml>
with pure xpath not. if invoke xpath other language, can select node first string type variable, parse string xml document , use second xpath expression select nodes inside. it
even if it's possible using pure xpath, two-step approach lot easier code, test , maintain.
Comments
Post a Comment