Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Avoid NodeType Comment

From: Martin Honnen <mahotrash@-----.-->
To: 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/


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