Sybase XML manual XPath abbreviated syntax, Syntax Description

Models: XML

1 290
Download 290 pages 48.58 Kb
Page 83
Image 83

Chapter 2 Building an XML model

XPath abbreviated syntax

You can use the following abbreviated syntax to define an XPath expression:

 

Syntax

Description

 

/

Root node of the XML document. It is the root

 

 

element with its ramifications

.

Selects the context node. It is the current

 

 

element (on which an identity constraint is

 

 

defined) with its ramifications

..

Selects the context node parent

*

Selects all the child elements of the context

 

 

node

 

employee

Selects all the employee child elements of the

 

 

context node

 

s:employee

Selects all the employee child elements of the

 

 

context node, defined in the namespace with the

 

 

“s” prefix

 

@numEmployee

Selects the numEmployee attribute of the

 

 

context node

@*

Selects all the attributes of the context node

 

../@numEmployee

Selects the numEmployee attribute of the

 

 

context node parent

 

employee[1]

Selects the first employee child element of the

 

 

context node

 

employee[last()]

Selects the last employee child element of the

 

 

context node

 

*/employee

Selects all the employee grandchildren of the

 

 

context node

 

//employee

Selects all the employee descendants of the root

 

 

node

 

.//employee

Selects the employee descendants of the context

 

 

node

 

company//employee

Selects the employee descendants of the

 

 

company child elements of the context node

 

//company/employee

Selects all the employee elements with company

 

 

as parent element in the context node

 

 

XSM User's Guide

71

Page 83
Image 83
Sybase XML manual XPath abbreviated syntax, Syntax Description