Chapter 2: The XML Document Object Model

Overview

This chapter tells you all about the XML Document Object Model, or XML DOM for short. The XML DOM allows complete dynamic access to all the bits and pieces within an XML document. The XML DOM allows the programmer not only to get the metadata of an XML document at run-time, but also to change an XML document at run-time.

The XML DOM is similar in nature and function to that of the HTML document object model, or HTML DOM. Typically the HTML DOM is accessed using programming languages such as JavaScript, VBScript, ASP, PHP, and many others. JavaScript for instance allows access to all the parts and pieces that make up an HTML page from the document as a whole, right down to all the buttons and pieces of text anything and everything making up an HTML web page.

You do not have to have a deep understanding of the HTML DOM in order to comprehend the material in this book or the XML DOM. It would help but it is unimportant. The HTML DOM simply allows dynamic access to HTML pages in a similar way that the XML DOM allows dynamic access to XML documents. In fact, the XML DOM is probably a lot easier to grasp because it is that much simpler than the HTML DOM. One of the primary advantages of using XML is its simplicity.

In essence, the XML DOM allows programmatic manipulation of all the contents of an XML document, even allowing programmers to build an XML document from scratch and this is without ever directly accessing the XML text and elements, but merely by accessing the structure that comprises that XML document (the metadata or defining structure). This is what allows for complete dynamic access to everything in an XML document.

In this chapter you learn about the following:

  • What the XML DOM is

  • The primary classes of the XML DOM

  • The Node and NodeList class

  • The Document class

  • The Element , Attr , and Text classes

  • The parseError class

  • The HTTPRequest class

  • Generating XML pages



Beginning XML Databases
Beginning XML Databases (Wrox Beginning Guides)
ISBN: 0471791202
EAN: 2147483647
Year: 2006
Pages: 183
Authors: Gavin Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net