Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Help needed with SelectSingleNode method >Thread Next - Re: Help needed with SelectSingleNode method Re: Help needed with SelectSingleNode methodTo: NULL Date: 2/1/2006 3:22:00 PM
Gary Freestone wrote:
> when I do a Node.SelectSingleNode("//Variable[0]").Text I expected a null
With XPath the index starts with 1 so I wonder why
//Variable[0]
should give you any node at all. Are you using MSXML 3 and have
forgotten to set
xmlDocument.setProperty "SelectionLanguage", "XPath"
before calling selectSingleNode?
As for your problem with the text property, it is defined here
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/a4310464-aeb3-4064-ad01-e0be461b787a.asp>
and clearly explains that for element nodes the text contents of all
child and descendant is being concatenated.
If you wanted to use XPath to check whether there are any direct child
text nodes then e.g. JScript
xmlDocument.selectNodes('/root/element[1]/text()').length == 0
would do.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
