A
Andrew Falanga
Hi,
I'm writing a routine to find a child node in an XML file that
basically walks the tree until the <tag></tag> is found. In learning
how to use the routines in System.Xml, I'm working in a sandbox. Now,
the search function I have written does work to find the node now.
The question is, as I'm trying to understand better what it is I'm
looking at, I'm dumping some of the properties to stdout. Something
that struck me odd is that the ParentNode property of the XmlNode
where my child was found, doesn't print the parent node but something
else. For example,
<SimpleXmlDoc>
<Example>
<Child1>
</Child1>
</Example>
</SimpleXmlDoc>
Now, I'm looking for Child1, which is found, but when I print out that
XmlNode's ParentNode property, I'm returned, "System.Xml.Element"
instead of, "Example." This is not what I was expecting.
Using the Object Browser in VS, the return, for an element node,
should be the parent XML (in this case, Example). From the object
browser:
"Element Returns the parent node of the element. If the element is the
root node in the tree, the parent is the document node."
So, what am I not understanding?
Andy
I'm writing a routine to find a child node in an XML file that
basically walks the tree until the <tag></tag> is found. In learning
how to use the routines in System.Xml, I'm working in a sandbox. Now,
the search function I have written does work to find the node now.
The question is, as I'm trying to understand better what it is I'm
looking at, I'm dumping some of the properties to stdout. Something
that struck me odd is that the ParentNode property of the XmlNode
where my child was found, doesn't print the parent node but something
else. For example,
<SimpleXmlDoc>
<Example>
<Child1>
</Child1>
</Example>
</SimpleXmlDoc>
Now, I'm looking for Child1, which is found, but when I print out that
XmlNode's ParentNode property, I'm returned, "System.Xml.Element"
instead of, "Example." This is not what I was expecting.
Using the Object Browser in VS, the return, for an element node,
should be the parent XML (in this case, Example). From the object
browser:
"Element Returns the parent node of the element. If the element is the
root node in the tree, the parent is the document node."
So, what am I not understanding?
Andy