Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Node value >Thread Next - Re: Node value Re: Node valueTo: NULL Date: 11/7/2007 1:49:00 PM
SimonZ wrote:
> I can read the value of xml node by:
>
> xmlAdv.getElementsByTagName("Avdertisments").item(0).childNodes(0).text
>
> This works but I would like to read the value of some node by its name
> instead of index:
>
> xmlAdv.getElementsByTagName("Avdertisments").item(0).childNodes("advID").text
>
> but this won't work.
>
> What is the right sintax?
If that is an element then you can use getElementsByTagName e.g.
xmlAdv.getElementsByTagName("Avdertisments").item(0).getElementsByTagName("advID").item(0).text
With MSXML you can also use XPath e.g. selectSingleNode
xmlAdv.getElementsByTagName("Avdertisments").item(0).selectSingleNode("advID").text
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
