i trying values of xml element. however, namespace not defined. i've tried using local-name() function not having luck.
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <entry xml:base="https://www.website.com" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/atom"> <id>a</id> <title type="text"></title> <updated>2015-07-21t02:40:30z</updated> <author> <name /> </author> <link rel="edit" title="application" href="a(1347)" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/b" type="application/atom+xml;type=feed" title="b" href="a(1347)/b" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/c" type="application/atom+xml;type=feed" title="c" href="a(1347)/c" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/d" type="application/atom+xml;type=entry" title="d" href="a(1347)/d" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/e" type="application/atom+xml;type=feed" title="e" href="a(1347)/e"> <m:inline> <feed> <title type="text">e</title> <id>1347</id> <updated>2015-07-21t02:40:30z</updated> <link rel="self" title="e" href="a(1347)/e" /> <entry> <id>www.website.com/</id> <title type="text"></title> <updated>2015-07-21t02:40:30z</updated> <author> <name /> </author> <link rel="edit" title="e" href="e(4294)" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/a" type="application/atom+xml;type=entry" title="application" href="e(4294)/a" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/d" type="application/atom+xml;type=entry" title="d" href="e(4294)/d" /> <category term="apimodel.filebasedocuments" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:id m:type="edm.int32">4294</d:id> <d:type>123</d:type> </m:properties> </content> </entry> <entry> <id>www.website.com</id> <title type="text"></title> <updated>2015-07-21t02:40:30z</updated> <author> <name /> </author> <link rel="edit" title="e" href="e(4295)" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/a" type="application/atom+xml;type=entry" title="a" href="e(4295)/a" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/d" type="application/atom+xml;type=entry" title="d" href="e(4295)/d" /> <category term="apimodel.filebasedocuments" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:id m:type="edm.int32">4295</d:id> <d:type>456</d:type> </m:properties> </content> </entry> </feed> </m:inline> </link> </entry> i want retrieve values inside of "m:properties/d:id m:type="edm.int32" (in case 4294) getting no luck. 1 file, there 1 "feed" tag filled multiple "entry" tags. inside these tags there 1 "m:properties/d:id m:type="edm.int32" need retrieve. suggestion on correct xpath situation?
instead of resorting namespace agnostic xml using local-name(), why not register namespace default namespace, e.g. x prefix xmlns:x="http://www.w3.org/2005/atom", , xpath like:
//x:feed/x:entry/x:content/m:properties/d:id[@m:type='edm.int32'] the local-name() approach more verbose:
//*[local-name()='feed']/*[local-name()='entry']/*[local-name()='content'] /*[local-name()='properties']/*[local-name()='id' , @m:type='edm.int32']
Comments
Post a Comment