Skip to Content
.NET & XML
book

.NET & XML

by Niel M. Bornstein
November 2003
Intermediate to advanced
476 pages
14h 38m
English
O'Reilly Media, Inc.
Content preview from .NET & XML

Introduction to the XPath Specification

Just like DOM, XPath operates on a tree-based view of an XML document. The XPath tree is built of the same node types used in DOM, except that CDATA sections, entity references, and document type declarations are not directly addressable. Their content is, however; the net result is that you can navigate to a text node’s content, but you cannot tell whether that content contains plain text, CDATA, expanded entity references, or some combination thereof. You cannot access document type declarations at all with XPath.

For this discussion, I’ll return to the inventory example from Chapter 5. That example included an inventory database that looked similar to the one in Example 6-1; here I’ve added some additional products.

Example 6-1. Angus Hardware inventory database
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE inventory SYSTEM "inventory.dtd"> <inventory> <!-- Warehouse inventory for Angus Hardware --> <date year="2002" month="7" day="6" /> <items> <item quantity="15" productCode="R-273" description="14.4 Volt Cordless Drill" unitCost="189.95" /> <item quantity="23" productCode="1632S" description="12 Piece Drill Bit Set" unitCost="14.95" /> <item quantity="10023" productCode="GN0250" description="1/4 inch Galvanized Steel Nails, 1/2 pound box" unitCost="4.95" /> <item quantity="9887" productCode="GN0375" description="3/8 inch Galvanized Steel Nails, 1/2 pound box" unitCost="189.95" /> <item quantity="8761" productCode="GN0500" description="1/2 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Applied XML Programming for Microsoft® .NET

Applied XML Programming for Microsoft® .NET

Dino Esposito
XML Hacks

XML Hacks

Michael Fitzgerald

Publisher Resources

ISBN: 0596003978Supplemental ContentErrata