You are confused why there are XmlNode and XmlElement classes.
Answer:
I was confused by this too. The confusion stems from the fact that if we deal with XML text (especially coming from the understanding of HTML and editing them with Notepad or whatever), what we normally deal with in XML are XmlElements. But in the Xml Standard, even the attributes within an element is a Node.
The detail is that XmlElements are the ones that has tags.
The second source of confusion is that just about everything in Xml is a subclass of XmlNode. That includes attributes in an XmlElement.
We should also note that in System.Xml namespace, XmlElement is a subclass of XmlLinkedNode class which is worthwhile examining in the Microsoft document.
All of this stems from the fact that Xml DOM (Document Object Model) dictates that everything is derived from the single Node class and System.Xml class classes closely follow this hierarchy.
No comments:
Post a Comment