17.6. The XPath data model We have been talking informally about the "objects" that XPath addresses, but what are they? One thing they certainly are not is the unparsed text of an XML document. That's because there are several alternative text strings that could mean the same thing, so addressing them would be ambiguous. For example, an apostrophe in data and the predefined entity reference ' are equivalent to an XML parser. XPath addresses the result of parsing. Computer scientists call the structure in Figure 17-2 a tree, even though it seems to be growing upside down! In fact, they usually speak of it as a family tree, as we have been doing, with ancestors, children, descendants, siblings, and so on. The objects in a computer science tree are called nodes, and nodes are the objects that XPath addresses. There are nodes that represent elements, textual data, attributes, and other things found by the parser. Tip | An advanced tutorial on XPath can be found in Chapter 24, "XML Path Language (XPath)", on page 498. | |