Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Xpath query to return "NULL" values?

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 6/5/2009 1:23:00 PM
Mario Splivalo wrote:
> Here is my XML document:
> 
> <a>
>   <b>1</b>
>   <b>2</b>
>   <b></b>
>   <b>3</b>
> </a>
> 
> When I execute this XPath query against it: /a/b/text()
> 
> I get only 1, 2 and 3:
> 
> mario@mike:~$ echo "<a><b>1</b><b>2</b><b></b><b>3</b></a>" | xpath -e '/a/b/@id'

Why /a/b/@id? There is no 'id' attribute in there at all.


> Is there a way to extract that NULL-valued node?

There is an empty 'b' element in there. If you want to select all 'b' 
elements then use the XPath
   /a/b
if you only want the empty 'b' elements then use
   /a/b[not(node())]


-- 

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/


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