Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


XML Objectified: IDOMNode's

December 21, 1998

You may be wondering, incidentally, if you can tell the type of a particular node. For instance, what if you did not know ahead of time which of these two nodes was the processing instruction? Not a problem!

The IDOMNode object, which we now begin to explore more closely, possesses a property named nodeType. By inspecting the nodeType of a particular node we can learn what sort of data it may possess, and whether or not it is able to have any children of its own.

Returning to our example:

petbase.childNodes(0).nodeType

yields

7 (NODE_PROCESSING_INSTRUCTION)
petbase.childNodes(1).nodeType

yields

1 (NODE_ELEMENT)

The question begs ... how do you know what a node type 7 or 1 means? Simple, at Microsoft's XML DOM reference page for the nodeType property.

From these nodeType properties we have also learned two additional facts: the first node is, in addition to being an IDOMNode object, also an IDOMProcessingInstruction object. The second node, in contrast, is both an IDOMNode object and an IDOMElement object. As you can see, although each node is an IDOMNode object, it is also a more specific object depending upon its type. Below is a handy summary of the types of objects which an IDOMNode can be:


IDOMAttribute Attribute object. Represents an attribute of an XML element.
IDOMCDATASection Reflects "quoted" or "escaped" blocks of text so that that text is not interpreted as markup.
IDOMCharacterData Text manipulation methods used by several objects.
IDOMComment Content of an XML comment.
IDOMDocumentFragment An object used when inserting data into the XML tree.
IDOMDocumentType Information associated with the document type declaration, or DTD.
IDOMElement Reflects an XML element, the most common object in an XML tree.
IDOMEntity A parsed or unparsed entity in the XML document.
IDOMEntityReference An entity reference node.
IDOMNotation Contains a notation declared in the DTD or schema, such as the format of unparsed entities, the format of elements that bear a notation attribute, or the application to which a processing instruction is addressed.
IDOMProcessingInstruction Reflects a "processing instruction," data intended for the XML processor contained in the document text.
IDOMText The data: text content of an element or attribute.


Exploring the reference links attached to each object in the above table you will see that different types of objects support different sets of properties, methods, and so forth. This is perfectly logical -- a processing instruction node doesn't contain the same type of data as an element node, for example.


XML Objectified: IDOMDocument
XML via the Document Object Model: A Preliminary Course
XML Objectified: IDOMElement


Up to => Home / Authoring / Languages / XML / DOM / Intro




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers