Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Avoid NodeType Comment [Thread Next] Re: Avoid NodeType CommentTo: NULL Date: 3/3/2006 5:12:00 PM Rasmus wrote: > Sounds link a nice way to do it. But there are 10-15 possible childnodes of > the book element. So I would prefer a solution that did not include using the > name of the child node Your original intention seemed to be to access one particular element, namely the author element. Doing that with an index into ChildNodes failed, doing it by name seems fine to me. I don't understand what you are now looking for, you only tell use that in your view there are 10-15 possible child nodes. Which exactly do you want to access, what are your criteria to access a node? As said you can use XPath e.g. bookNode.SelectSingleNode("xpath expression goes here") but I can only suggest an XPath expression if I understand what node exactly you are looking for. If you wanted all child element nodes you could do e.g. XmlNodeList nodeList = bookNode.SelectNodes("*"); and then iterate over that node list. If you wanted all author elements e.g. XmlNodeList nodeList = bookNode.SelectNodes("author"); would do. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
