XPath Help - PowerPoint PPT Presentation

About This Presentation
Title:

XPath Help

Description:

We want to extract the 'static' part of XPath ... what is meaning of / B and / / B? Mixing strategies and XPath?? what would the meaning be of: ... – PowerPoint PPT presentation

Number of Views:83
Avg rating:3.0/5.0
Slides: 14
Provided by: karljlie
Category:
Tags: bb | help | xpath

less

Transcript and Presenter's Notes

Title: XPath Help


1
XPath Help
  • Karl Lieberherr

2
Source of information / Plan
  • http//www.w3.org/TR/2005/WD-xpath20-20050915/
  • Complex definition
  • We want to extract the static part of XPath
  • Objective Use / and // (//) to build sequences
    and use operators union, intersection and except
    to combine them.

3
Mismatches
  • XPath can work without schema.
  • But we want to visualize XPath expression in
    schema.
  • Works only for static XPath expressions
  • XPath views meaning of expression as a sequence.
  • Strategies views the meaning of an expression as
    a function that maps objects to object graph
    slices. Traversing slice sequence of nodes.

4
Mismatches
  • But we can also view the meaning of a strategy
    and a class graph as another graph
    TraversalGraph

5
XPath data model
  • In the data model, a value is always a sequence.
  • A sequence is an ordered collection of zero or
    more items.
  • An item is either an atomic value or a node.
  • singleton, empty sequence. Sequences are never
    nested.

6
EBNF for XPath
  • 26   PathExpr      ("/" RelativePathExpr?)
    ("//" RelativePathExpr) RelativePathExpr
  • 27   RelativePathExpr      StepExpr (("/"
    "//") StepExpr)
  • 28   StepExpr      AxisStep FilterExpr

7
Class dictionaries / EBNF
  • exercise3.txt
  • class dictionaries are both a simplification and
    extension of EBNF.

8
EBNF for XPath
  • 30   ForwardStep      (ForwardAxis NodeTest)
    AbbrevForwardStep
  • 31   ForwardAxis      lt"child" ""gt
    lt"descendant" ""gt lt"attribute" ""gt
    lt"self" ""gt lt"descendant-or-self" ""gt
    lt"following-sibling" ""gt lt"following" ""gt
    lt"namespace" ""gt

9
EBNF for XPath
  • 3.3.3 Combining Node Sequences
  • 14   UnionExpr      IntersectExceptExpr (
    ("union" "") IntersectExceptExpr )
  • 15   IntersectExceptExpr      InstanceofExpr
    ( ("intersect" "except") InstanceofExpr )
  • 16   InstanceofExpr   PathExpr

10
sequence operations
  • XPath provides the following operators for
    combining sequences of nodes
  • The union and operators are equivalent. They
    take two node sequences as operands and return a
    sequence containing all the nodes that occur in
    either of the operands.
  • The intersect operator takes two node sequences
    as operands and returns a sequence containing all
    the nodes that occur in both operands.
  • The except operator takes two node sequences as
    operands and returns a sequence containing all
    the nodes that occur in the first operand but not
    in the second operand.

11
sequence operations
  • seq1 is bound to (A, B)
  • seq2 is bound to (A, B)
  • seq3 is bound to (B, C)
  • Then
  • seq1 union seq2 evaluates to the sequence (A,
    B).
  • seq2 union seq3 evaluates to the sequence (A,
    B, C).
  • seq1 intersect seq2 evaluates to the sequence
    (A, B).
  • seq2 intersect seq3 evaluates to the sequence
    containing B only.
  • seq1 except seq2 evaluates to the empty
    sequence.
  • seq2 except seq3 evaluates to the sequence
    containing A only.

12
Declare context node type
  • what is meaning of / B and // B?

13
Mixing strategies and XPath??
  • what would the meaning be of
  • s1 from A via B to C
  • s2 A // D
  • union (s1 s2)
Write a Comment
User Comments (0)
About PowerShow.com