What is XPath (XML Path)?

This section provides a quick introduction of XPath (XML Path), which is an expression language to produce a value that represents sub structure of an XML document.

What Is XPath (XML Path)? XPath is an expression evaluation language to produce a value that represents sub structure of an XML document.

You can compare XPath with regular expression, which is an expression language to produce a value that represents sub structure of a text string.

You can compare XPath with the DOS path name convention, which is a simple expression language to produce a value that represents a sub structure of a file system.

Writing an XPath expression involves following aspects:

XPath is used currently in both XSLT and XPointer.

Here are some examples of XPath expressions:

.             Representing the current node
img           Representing child elements named as "img"
@color        Representing the attribute named as "id"
/html         Representing the root element named as "html"
p[1]          Representing the first occurrence of child "p" elements
p[@id=open]   Representing child "p" elements with id="open" attribute

Last update: 2014.

Table of Contents

 About This Book

 Introduction of XML (eXtensible Markup Language)

 XML File Syntax

 XML File Browsers

 DOM (Document Object Model) Programming Interface

 SAX (Simple API for XML) Programming Interface

 DTD (Document Type Definition) Introduction

 Syntaxes of DTD Statements

 Validating an XML Document against the Specified DTD Document Type

 XSD (XML Schema Definition) Introduction

 Syntaxes of XSD Statements

 Validating XML Documents Against Specified XML Schemas

 XSL (Extensible Stylesheet Language) Introduction

 XSLT (XSL Transformations) Introduction

 Java Implementation of XSLT

XPath (XML Path) Language

What is XPath (XML Path)?

 Data Types, Literals and Variables

 Evaluation Context

 Built-in Functions

 Expressions and Location Paths

 Using XPath in XSLT Templates

 XSLT Elements as Programming Statements

 Control and Generate XML Element in the Result

 XML Notepad - XML Editor

 XML Tools Plugin for Notepad++

 XML 1.1 Changes and Parsing Examples

 Outdated Tutorials

 References

 PDF Printing Version