Fog Creek Software
Discussion Board




Node vs. Element

What's the difference in between the IXMLDOMElement and IXMLDOMNode in the MSXML x.0 parser?

Sathyaish Chakravarthy
Monday, January 12, 2004

Just look at the inheritance hierarchy. An XML "node" is the basic data structure from which DOM builds its tree. A node can be an attribute, an element, or probably other things like a comment (don't recall exactly how DOM works).

Chris Nahr
Monday, January 12, 2004

Oh yeah, that reconciles it. You mean the IXMLDOMNode is the base interface and all the elements that are nodes are one of the types - either an element or a processing instruction or a comment or a CDATA section or a DOCTYPE etc. and hence the nodeType property. Thanks, I got it.

Where can I see a diagram of the heirarchy?

Sathyaish Chakravarthy
Monday, January 12, 2004

http://www.w3.org/TR/REC-DOM-Level-1

This is the formal W3C specification for the Document Object Model specification.

The representation of XML documents as Nodes and Elements and Attributes (etc) isn't really a part of the XML specification. It's part of the DOM specification.

Although there's no graphical diagram of the object hierarchy included in the specification, it's all there in text, as an IDL (Interface Definition Language) hierarchy.

Benji Smith
Monday, January 12, 2004

Sorry, apparently MSDN doesn't provide a graphical inheritance hierarchy.

However, "Essential XML Quick Reference" by Aaron Skonnard and Martin Gudgin (Addison-Wesley 2002) has an UML diagram for DOM level 2 on page 194. This diagram clearly shows how Node sits at the root of the hierarchy.

This book is a highly recommended desktop reference if you're doing any serious XML work, by the way.

Chris Nahr
Monday, January 12, 2004

*  Recent Topics

*  Fog Creek Home