xpath help n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
XPath Help PowerPoint Presentation
Download Presentation
XPath Help

Loading in 2 Seconds...

play fullscreen
1 / 13
sauda

XPath Help - PowerPoint PPT Presentation

146 Views
Download Presentation
XPath Help
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  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   ::=   (ForwardAxisNodeTest) | AbbrevForwardStep • [31]   ForwardAxis   ::=   <"child" "::">| <"descendant" "::">| <"attribute" "::">| <"self" "::">| <"descendant-or-self" "::">| <"following-sibling" "::">| <"following" "::">| <"namespace" "::">

  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)