Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Help in using XPath for XML having multiple namespace declarations

From: sai@-----------.---------.---
To: NULL
Date: 12/4/2006 2:22:00 AM

I am using the following xml library and language.
XML Library: MSXML 3.0
Langguae used: C

"sai" wrote:

> 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.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent