XPATH

Estudies4you
Advantages of XPath
XPATH
  • XPath
    • is used to navigate through elements and attributes in an XML document
    • is a major element in W3C's XSLT standard
    • is a syntax for defining parts of an XML document
    • uses path expressions to navigate in XML documents
    • contains a library of standard functions
    • is a W3C recommendation
  • XQuery and XPointer are both built on XPath expressions
XPATH Expressions
  • XQuery and XPointer are both built on XPath expressions
  • XPath uses path expressions to select nodes or node-sets in an XML document
  • XPath expressions look very much similar to traditional computer file system
XPath in XSLT
  • XPath is a major element in the XSLT standard
  • XPath is the result of an effort to provide a common syntax and semantics for functionality shared between XSL Transformations [XSLT] and XPointer [XPointer]
Advantages of XPath
  • The primary purpose of XPath is to address parts of an XML [XML] document
  • Xpath also provides basic facilities for manipulation of strings, numbers and booleans
  • XPath uses a compact, non-XML syntax to facilitate use of XPath within URIs and XML attribute values
  • XPath operates on the abstract, logical structure of an XML document, rather than its surface syntax
  • XPath gets its name from its use of a path notation as in URLs for navigating through the hierarchical structure of an XML document
XPath node
  • XPath models an XML document as a tree of different type of nodes such as element nodes, attribute nodes and text nodes
  • XPath defines a way to compute a string value for each type of node
  • XPath fully supports XML Namespaces. The name of a node is modelled as a pair consisting of a local part and a possibly null namespace URI; this is called an expanded name
  • The primary syntactic construct in XPath is the expression
  • XML documents are treated as trees of nodes
  • The topmost element of the tree is called the root element
XPath Expression
  • An expression matches the production Expr
  • An expression is evaluated to yield an object, which has one of the following four basic types:
    • node-set (an unordered collection of nodes without duplicates)
    • boolean (true or false)
    • number (a floating-point number)
    • string (a sequence of UCS characters)


To Top