O'Reilly logo

Beginning XML, 4th Edition by Andrew Watt, David Hunter, Linda McKinnon, Joe Fawcett, Eric van der Vlist, Jon Duckett, Danny Ayers, Jeff Rafter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. The XML Document Object Model (DOM)

This chapter explores the XML Document Object Model, often called the XML DOM or simply the DOM, and how it can be manipulated in various ways. The XML DOM is primarily used by programmers as a way to manipulate the content of an XML document. The XML DOM is useful for tasks as diverse as manipulating data from an RSS feed to animating part of an SVG graphic.

Although many XML programmers refer to the XML DOM simply as the DOM, the term DOM can also be used to refer to the HTML Document Object Model, the XML Document Object Model, or both. In this chapter the focus is on the XML DOM.

This chapter covers the following:

  • The purpose of the XML Document Object Model

  • How the DOM specification was developed at the W3C

  • Important XML DOM interfaces and objects, such as the Node and Document interfaces

  • How to add and delete elements and attributes from a DOM and manipulate a DOM tree in other ways

  • How the XML DOM is used "under the covers" in Microsoft InfoPath 2003

Purpose of the XML DOM

The XML DOM provides an interface for programmers to create XML documents; to navigate them; and to add, modify, or delete parts of those XML documents while they are held in memory. There are a number of ways that an in-memory representation can be created:

  • One of the possibilities is to read a file from disk. This is a common technique now when dealing with configuration files; user options held in an XML format are easier to deal with than traditional techniques ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required