Extracting Data from XML
WHAT YOU WILL LEARN IN THIS CHAPTER:
- How XML is usually represented in memory
- What the DOW and the XDM are
- What XPath is
- How to read and write XPath expressions
- How to learn more about the XPath language when you need it
DOCUMENT MODELS: REPRESENTING XML IN MEMORY
XML is a text-based way to represent documents, but once an XML document has been read into memory, it’s usually represented as a tree. To make developers’ lives easier, several standard ways exist to represent and access that tree. All of these ways have differences in implementation, but once you have seen a couple, the others will generally seem very similar.
This chapter briefly introduces three of the most widely used models; you learn more about each of them later in the book. You also learn how to avoid using these data models altogether using XPath (in this chapter) and XQuery (in Chapter 9).
Meet the Models: DOM, XDM, and PSVI
The best-known data model for storing and processing XML trees is called the W3C document object model, or the DOM for short. The ...