Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Help in using XPath for XML having multiple namespace declarations Help in using XPath for XML having multiple namespace declarationsTo: NULL Date: 12/4/2006 2:15:00 AM I have the following xml files. xml1: <?xml version=\"1.0\"?> <presence xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:ex=\"urn:ietf:params:xml:ns:pidf:ex\" > <tuple id='xyz'> <status><basic>online</basic><ex:ex>busy</ex:ex></status> </tuple> <tuple id='xyz1'> <status><basic>offline</basic></status> </tuple> </presence> xml2: <?xml version=\"1.0\"?> <tns:presence xmlns:tns=\"urn:ietf:params:xml:ns:pidf\" xmlns:ex=\"urn:ietf:params:xml:ns:pidf:ex\" > <tuple id='xyz'> <status><basic>online</basic><ex:ex>busy</ex:ex></status> </tuple> <tuple id='xyz1'> <status><basic>offline</basic></status> </tuple> </tns:presence> 1. If I use the "xml1" xml file and execute the following XPath query "//tuple", I got the response as 0 nodes matched 2: If I use the "xml2" file and execute the same XPath query as above, then I got the response as 2 nodes matched. Q1. I do not see any difference in the xml files and both represent same thing but why do i get differnet response for the same query. Is is mandatory to write namespace declarations similar to that of in xml file "xml2". Q2. How should be the XPath query for searching for "ex:ex" element? If I use the following XPath query, I am getting the response as 0 nodes matched. Thanks in advance for your help. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
