Jan. 11, 2011, 4:39 a.m.
posted by norman
Unlike the HTML DOM, the real beauty of the XML DOM is that the XML DOM is language- and platform-independent. This makes the XML DOM exactly the same for all those languages and platforms. Just like an XML document itself, the XML DOM is a hierarchical structure of objects. In the case of an XML document, those objects are called nodes.
The word “node” is used in many fields to describe what is essentially a joint in a structure of some kind, such as the joints in a tree between branches. In computer jargon a node is often a terminal on a computer network, even down to a web browser, on any computer anywhere on the Internet. An XML document is a hierarchical structure, a little like an upside down tree. So, every single tag (element) in an XML document is a node, which is a potential branch or connection to other child nodes.
The only problem with the XML DOM is that there is a lot to it, and more than one way to get at the same thing, using different browsers from different vendors. This book focuses mostly on Microsoft products because they are the most widely used. For the purposes of this book and focusing on XML and databases, I am going to keep it simple. The first thing we need to do is examine the general structure of the DOM for an XML document, from a purely structural perspective. This structure is shown in Figure.
The actual class.structure of the XML DOM is quite different from that shown in Figure. This book is not about XML, but rather about XML as it pertains to databases. So the intention is to introduce the parts of XML simply to begin with and then expand as needed as you go through the entire book. The only class.s within the XML DOM that are important to this book at present are those shown in Figure.
Please understand that I am not attempting to explain the diagrams shown in Figure and Figure. This is deliberate. For now, all I am trying to do is to give you a mental picture that is easy to imagine and remember.
Inheritance means that a child class.can inherit all the attributes and methods of its parent class. For example, the Document class.inherits all attributes and methods contained in the Node class. unless overridden by the same named methods or attributes in the Document class.
A collection is an inclusion of an array or a repetition of one class.within another. For example, the NodeList class.is a repetition contained within the Node class. and thus a collection of nodes within a node. The word “collection” is essentially an object methodology term for the word “array” in programmatic parlance. The terms “collection” and “array” are synonymous.
When it comes to object structure and the XML DOM, it is important to understand the difference between an object and a class. A class.defines programmatically how an application is built. An object is the instantiation of the class.structure at run-time. As you can see in the diagrams in Figure and Figure, there is quite a difference between the XML DOM object structure and the XML DOM class.structure. Rather than draw a complex picture of all attributes and methods in all class.s, it might be best to examine each of those represented in Figure one by one. There are parts I will omit in the interests of simplicity and because I do not think those pieces pertain directly to the material of this book. After all, this book is primarily about XML and databases, and more specifically how XML can be used both as a database and in other databases, such as Oracle Database or Microsoft SQL Server.