Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
This property is read-only. Depending on the type of Node,
this property returns a string containing the Node's name.
This is especially useful with elements and attributes. Table
details what is being represented by the nodeName property for
the different interfaces of the DOMDocument.
0.0.1 Return values for the different XMLDOM interfaces
(continued)
Interface
name
Return value
XML DOM
Element
The name of the element tag is
returned, without the tag indi cators (</>).
XML Example: <EMAIL>markwilson@somewhere.com</
EMAIL>
Returns: EMAIL
When dealing with namespaces , the full tag name is returned.
XML Example: <resume:EMAIL>markwilson@some
where.com</resume:EMAIL>
Returns: resume:EMAIL
XML DOM
Attribute
The name of the element is
returned.
XML Example: <PERSON PERSONID="p1">
Returns: PERSONID
XML DOM
ProcessingIn struction
The target of the processing
instruction is returned. This is the first word after the
`<?' indicators.
XML Example: <?xml version="1.0" ?>
Returns: xml
XML DOM
EntityReference
The name of the entity that is being
references is returned, stripping off the entity reference
indicators, namely the "&;".
XML Example: <ADDRESS>30 Animal Road, New York,
&USA;</ADDRESS>
Returns: USA
XML DOM
Entity
The name of the entity is
returned.
XML Example: <!ENTITY USA "United States of
America">
Returns: USA
XML DOM
DocumentType
The name of the document type (DTD)
is returned.
XML Example: <!DOCTYPE PEOPLE SYSTEM
"http://localhost/xml code/people.dtd">
Returns: PEOPLE
XML DOM
Notation
The name of the notation is
returned.
XML Example: <img
src="http://localhost/xmlcode/vbdev.gif">
Returns: img
The Node types listed in table do not have nodeNames;
therefore, they return the following string literals of what is
being referenced.
0.0.1 Return values for XMLDOM interfaces with no
nodeNames
Interface
name
Return value
XML DOM Text
#text
XML DOM
Comment
#comment
XML DOM
CDATASection
#cdata-section
XML DOM
Document
#document
XML DOM
DocumentFragment
#document-fragment
Example
When we want to populate the textboxes on a VB form, we use
the nodeName property to work with a Select Case as the decider
of which text box should be populated.
In the following example, we have already obtained a reference
to an element, which in this case is the PERSON element from our
main XML example. We are now looping through its child Nodes,
differentiating which Node is current by its nodeName
property.
For Each objChildElement In objPersonElement.childNodes
If objChildElement.nodeType = NODE_ELEMENT Then
Select Case UCase(objChildElement.nodeName)
Case "NAME"
txtName.Text = objChildElement.nodeTypedValue
Case "ADDRESS"
txtAddress.Text = objChildElement.nodeTypedValue
Case "TEL"
txtTel.Text = objChildElement.nodeTypedValue
Case "FAX"
txtFax.Text = objChildElement.nodeTypedValue
Case "EMAIL"
txtEmail.Text = objChildElement.nodeTypedValue
End Select
End If
Next objChildElement
This manuscript is an abridged version of a chapter from the
Manning
Publications book XMLProgramming with VB and ASP. This chapter
looks at the Microsoft DOM objects. NOTE: Most images have been
removed to increase speed and many of the code comments have also
been removed for presentation. Please purchase the book to enjoy
the full experience of all the chapters with images and code
comments!