Simpson - XPath and XPointer (O'Reilly, 2002).pdf
(
2766 KB
)
Pobierz
CopyrightTable of ContentsIndexFull DescriptionReviewsReader reviewsErrata
XPath and XPointer
John E. Simpson
Publisher: O'Reilly
First Edition August 2002
ISBN: 0-596-00291-2, 224 pages
Table of Contents
Index
Full Description
Reviews
Reader reviews
Errata
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
Table of Content
Table of Content ............................................................................................................. 2
Preface............................................................................................................................. 4
Who Should Read This Book?.................................................................................... 4
Who Should Not Read This Book?............................................................................. 4
Organization of the Book............................................................................................ 5
Conventions Used in This Book ................................................................................. 5
Comments and Questions ........................................................................................... 6
Acknowledgments....................................................................................................... 7
Chapter 1. Introducing XPath and XPointer ................................................................... 8
1.1 Why XPath and XPointer?.................................................................................... 8
1.2 Antecedents/History.............................................................................................. 9
1.3 XPath, XPointer, and Other XML-Related Specs .............................................. 12
1.4 XPath and XPointer Versus XQuery .................................................................. 15
Chapter 2. XPath Basics ............................................................................................... 17
2.1 The Node Tree: An Introduction......................................................................... 17
2.2 XPath Expressions .............................................................................................. 18
2.3 XPath Data Types ............................................................................................... 24
2.4 Nodes and Node-Sets .......................................................................................... 27
2.5 Node-Set Context................................................................................................ 38
2.6 String-Values ...................................................................................................... 40
Chapter 3. Location Steps and Paths............................................................................. 43
3.1 XPath Expressions .............................................................................................. 43
3.2 Location Paths..................................................................................................... 45
3.3 Location Steps..................................................................................................... 48
3.4 Compound Location Paths Revisited.................................................................. 63
Chapter 4. XPath Functions and Numeric Operators.................................................... 64
4.1 Introduction to Functions.................................................................................... 64
4.2 XPath Function Types......................................................................................... 66
4.3 XPath Numeric Operators................................................................................... 92
Chapter 5. XPath in Action........................................................................................... 95
5.1 XPath Visualiser: Some Background.................................................................. 95
5.2 Sample XML Document ..................................................................................... 97
5.3 General to Specific, Common to Far-Out ........................................................... 99
Chapter 6. XPath 2.0 ................................................................................................... 122
6.1 General Goals.................................................................................................... 123
6.2 Specific Requirements ...................................................................................... 126
Chapter 7. XPointer Background ................................................................................ 141
7.1 XPointer and Media types................................................................................. 141
7.2 Some Definitions .............................................................................................. 143
7.3 The Framework ................................................................................................. 146
2
7.4 Error Types ....................................................................................................... 147
7.5 Encoding and Escaping Characters in XPointer ............................................... 148
Chapter 8. XPointer Syntax ........................................................................................ 153
8.1 Shorthand Pointers ............................................................................................ 153
8.2 Scheme-Based XPointer Syntax ....................................................................... 154
8.3 Using XPointers in a URI ................................................................................. 163
Chapter 9. XPointer Beyond XPath ............................................................................ 165
9.1 Why Extend XPath?.......................................................................................... 165
9.2 Points and Ranges ............................................................................................. 167
9.3 XPointer Extensions to Document Order ......................................................... 174
9.4 XPointer Functions ........................................................................................... 178
Appendix A. Extension Functions for XPath in XSLT .............................................. 187
A.1 Additional Functions in XSLT 1.0................................................................... 187
A.2 EXSLT Extensions........................................................................................... 188
Colophon..................................................................................................................... 197
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
Plik z chomika:
sigebryht
Inne pliki z tego folderu:
Cerami - Web Services Essentials (O'Reilly, 2002).pdf
(1758 KB)
Coyle - XML, Web Services, and the Data Revolution (AW, 2003).chm
(3060 KB)
Fitzgerald - Learning XSLT (O'Reilly, 2003).chm
(1138 KB)
Hamilton - Learning UML 2.0 (O'Reilly, 2006).chm
(4113 KB)
Holzner - Inside XML (New Riders, 2000).chm
(4767 KB)
Inne foldery tego chomika:
C, C++, C Sharp
HTML, CSS, Javascript, Ajax
Java
Macromedia Flash
Perl
Zgłoś jeśli
naruszono regulamin