xpath_and_xpointer.pdf

(2766 KB) Pobierz
CopyrightTable of ContentsIndexFull DescriptionReviewsReader reviewsErrata
John E. Simpson
Publisher: O'Reilly
First Edition August 2002
ISBN: 0-596-00291-2, 224 pages
Referring to specific information inside an XML document is a little like
finding a needle in a haystack. XPath and XPointer are two closely related
languages that play a key role in XML processing by allowing developers
to find these needles and manipulate embedded information. By the time
you've finished XPath and XPointer , you'll know how to construct a full
XPointer (one that uses an XPath location path to address document
content) and completely understand both the XPath and XPointer features it
uses.
1
15179404.001.png 15179404.002.png
Table of Content
2
3
Preface
XML documents contain regular but flexible structures. Developers can use those
structures as a framework on which to build powerful transformative and reporting
applications, as well as to establish connections between different parts of documents.
XPath and XPointer are two W3C-created technologies that make these structures
accessible to applications. XPath is used for locating XML content within an XML
document; XPointer is the standard for addressing such content, once located. The two
standards are not typically used in isolation but in support of two critical extensions to the
core of XML: Extensible Stylesheet Language Transformations (XSLT) and XLink,
respectively. They are also finding wide use in other applications that need to reference
parts of documents. These two closely related technologies provide the underpinning of
an enormous amount of XML processing.
Who Should Read This Book?
Presumably, if you're browsing a book like this, you already know the rudiments of XML
itself. You may have experimented with XSLT but, if so, haven't completely mastered it.
(You can't do much in XSLT without first becoming comfortable with at least the basics
of XPath.) Similarly, you may have experimented with XLinks; in this case, you've
probably focused on linking to entire documents other than the one containing the link.
XPointer will be your tool of choice for linking to portions of documents — external to or
within the document where the XLink reference is made.
As support for XPath is integrated into the Document Object Model (DOM), DOM
developers may also find XPath a convenient alternative to walking through document
trees. Finally, developers interested in hypertext and other applications where references
may have to cross node boundaries will find a thorough explanation of XPointer, the
leading technology for creating those references.
You need not be an XML document author or developer to read this book. The XPath
standard is fairly mature, and therefore is already incorporated in a number of high-level
tools. XPointer, by contrast, is not yet a final standard; for this reason, the use of
XPointers will probably be limited to experimental purposes in the short term.
Regardless of whether you're coming at the subject as primarily a document author or
designer, or as a developer, XPath and XPointer can be revisited as often as you need it:
for reference or as a refresher.
Who Should Not Read This Book?
If you don't yet understand XML (including XML namespaces) and have never looked at
XSLT, you probably need to start with an XML book. John E. Simpson's Just XML
(Prentice-Hall PTR) and Erik Ray's Learning XML (O'Reilly & Associates) are both good
places to start.
4
Organization of the Book
Chapter 1 introduces you to the foundations of XPath and XPointer, and where they're
used.
Chapter 2 gets you started with XPath's node tree model for documents and XPath
syntax, as well as the set of node types accessible in XPath.
Chapter 3 moves deeper into XPath, detailing the use of XPath axes, node tests, and
predicates.
Chapter 4 explains the tools XPath offers for manipulating content once it has been
located.
Chapter 5 demonstrates XPath techniques with over 30 examples using a wide variety of
XPath parts.
Chapter 6 examines the upcoming 2.0 version of XPath, including new features and
interoperability issues.
Chapter 7 explains XPointer's perspective on XML documents and how its use in URLs
requires some changes from basic XPath.
Chapter 8 explains the details of using XPointer syntax, including "bare names," child
sequences, and interactions with namespaces.
Chapter 9 delves deeper into XPointer, exploring the techniques XPointer offers for
referencing points and ranges of text, not just nodes.
Conventions Used in This Book
The following font conventions are used throughout the book:
Constant width is used for:
Code examples and fragments
Anything that might appear in an XML document, including element names, tags,
attribute values, entity references, and processing instructions
Anything that might appear in a program, including keywords, operators, method
names, class names, and literals
Constant-width bold is used for:
User input
Signifying emphasis in code statements
5
Zgłoś jeśli naruszono regulamin