Vba xml dom nodes in Excel
In the previous chapter, we saw the basics of DOM or Document Object Model.
The DOM specifies the Logical structure of the XML document.
In this chapter, we will explore the DOM Nodes in detail.
What is a Node?
According to the Document Object Model of XML, everything in a XML file is a node.
The entire document is a document node.
Every XML element is an element node.
The text in the XML elements are text nodes.
Every attribute is an attribute node.
Comments are comment nodes.
Consider the following XML document as an example.
- <?xml�version="1.0"�encoding="UTF-8"?>
- <Agencies>
- <Contractor>
- ����<name>Bhandhan Servicing</name>
- ����<service_type>Marriage arrangement</service_type>
- ����<description>
- All Services related to marriages
- ���</description>
- </Contractor>
- <Contractor>
- ����<name>VS functions</name>
- ����<service_type>Party arrangements</service_type>
- ����<description>
- Official get together, birthday party arrangements.
- ����</description>
- </Contractor>
- <Contractor>
- ����<name>Swami services</name>
- ����<service_type>Spiritual Services</service_type>
- ����<description>
- ��� Ganapathi homam, New home poojas performed.
- ����</description>
- </Contractor>
- <Contractor>
- ����<name>B Plus Services</name>
- ����<service_type>Blood Donation</service_type>
- ����<description>
- ��� Conducts Blood donation camps, organizing emergency blood donation
- ����</description>
- ����<calories>600</calories>
- </Contractor>
- </Agencies>
With reference to the above XML document, we will explore the various nodes discussed above.
<Agencies> is the root node of the document.
<Contractor> is the child node of the root node <bookstore>
<Contractor> node holds the child nodes: <name>, <service_type> and <description>.
The child nodes contain one text node each in every Contrator nodes and its child nodes.