Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: difference between IXMLDOMElement and IXMLDOMNode

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 10/1/2005 12:23:00 PM

alexl wrote:


> not clear on the difference between IXMLDOMElement and IXMLDOMNode. I
> thought they both represent a tag?
>  <sampletag>
    ^^^^^^^^^^
That is a tag, a start tag, and here
   </sampletag>
   ^^^^^^^^^^^
you have another tag, an end tag. In the markup (the source code of an 
XML document) there are tags while on the logical structure there are 
elements.
In the DOM a hierachical object oriented approach has been taken to 
model an XML document as a tree of nodes where you have a common base 
class or interface Node and other more specialized interfaces or classes 
that extend Node, e.g. Element, Document, Text, Attribute, 
ProcessingInstruction, Comment.
So everything you have in the DOM object model of an XML document is a 
node and has at least the properties and methods defined for the Node 
interface (or IXMLDOMNode in the case of MSXML).
But while there are common properties and methods all types of nodes 
share there a specialized properties/methods for for instance element 
nodes and these are defined by the Element respectively IXMLDOMElement 
interface.
As long as you use dynamic scripting languages like JavaScript or 
VBScript to script the DOM you can simply check
   node.nodeType
to find which type of node you have (e.g. 1 for element node, 3 for text 
node) and you can always simply use the properties and methods of the 
most specialized interface then.
In compiled languages with typed variables however you might need to 
cast a node to a specialized class or interface to be able to use the 
specialized properties or methods.



-- 

	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