mozdev.org

XPointerLib    

resources:

XPointer Grammar


XPointer Forms
[1]    XPointer    ::=    Name



| ChildSeq



| FullXPtr

The internal structure of an XPointer is as follows.

Internal Structure of XPointer
[2]    ChildSeq    ::=    Name? ('/' [1-9] [0-9]* )+
[3]    FullXPtr    ::=    XPtrPart (S? XPtrPart)*
[4]    XPtrPart    ::=    'xpointer' '(' XPtrExpr ')'



| 'xmlns' '(' XPtrNsDecl? ')'



| Scheme '(' SchemeSpecificExpr ')'
[5]    Scheme    ::=    NCName
[6]    SchemeSpecificExpr    ::=    StringWithBalancedParens
[7]    StringWithBalancedParens    ::=    [^()]* ('(' StringWithBalancedParens ')' [^()]*)* [VC: Parenthesis escaping ]
[8]    XPtrExpr    ::=    Expr [VC: Parenthesis escaping ]
[9]    XPtrNsDecl    ::=    NCName S? '=' S? XPtrNsURI
[10]    XPtrNsURI    ::=    Char* [VC: Parenthesis escaping ]




[VC: Namespace Name ]

XPath Grammar, Augmented With XPointer Changes

Location Paths
[1]    LocationPath    ::=    RelativeLocationPath



| AbsoluteLocationPath
[2]    AbsoluteLocationPath    ::=    '/' RelativeLocationPath?



| AbbreviatedAbsoluteLocationPath
[3]    RelativeLocationPath    ::=    Step



| RelativeLocationPath '/' Step



| AbbreviatedRelativeLocationPath

Location Steps
[4]    Step    ::=    AxisSpecifier NodeTestPredicate*



| AbbreviatedStep



| 'range-to' '(' Expr ')' Predicate*

[5]    AxisSpecifier    ::=    AxisName '::'



| AbbreviatedAxisSpecifier

[6]    AxisName    ::=    'ancestor'



| 'ancestor-or-self'



| 'attribute'



| 'child'



| 'descendant'



| 'descendant-or-self'



| 'following'



| 'following-sibling'



| 'namespace'



| 'parent'



| 'preceding'



| 'preceding-sibling'



| 'self'
[7]    NodeTest    ::=    NameTest



| NodeType '(' ')'



| 'processing-instruction' '(' Literal ')'

Predicates
[8]    Predicate    ::=    '[' PredicateExpr ']'
[9]    PredicateExpr    ::=    Expr
Abbreviations
[10]    AbbreviatedAbsoluteLocationPath    ::=    '//' RelativeLocationPath
[11]    AbbreviatedRelativeLocationPath    ::=    RelativeLocationPath '//' Step
[12]    AbbreviatedStep    ::=    '.'



| '..'
[13]    AbbreviatedAxisSpecifier    ::=    '@'?

[14]    Expr    ::=    OrExpr
[15]    PrimaryExpr    ::=    VariableReference



| '(' Expr ')'



| Literal



| Number



| FunctionCall
[16]    FunctionCall    ::=    FunctionName '(' ( Argument ( ',' Argument )* )? ')'
[17]    Argument    ::=    Expr

[18]    UnionExpr    ::=    PathExpr



| UnionExpr '|' PathExpr
[19]    PathExpr    ::=    LocationPath



| FilterExpr



| FilterExpr '/' RelativeLocationPath



| FilterExpr '//' RelativeLocationPath
[20]    FilterExpr    ::=    PrimaryExpr



| FilterExpr Predicate

[21]    OrExpr    ::=    AndExpr



| OrExpr 'or' AndExpr
[22]    AndExpr    ::=    EqualityExpr



| AndExpr 'and' EqualityExpr
[23]    EqualityExpr    ::=    RelationalExpr



| EqualityExpr '=' RelationalExpr



| EqualityExpr '!=' RelationalExpr
[24]    RelationalExpr    ::=    AdditiveExpr



| RelationalExpr '<' AdditiveExpr



| RelationalExpr '>' AdditiveExpr



| RelationalExpr '<=' AdditiveExpr



| RelationalExpr '>=' AdditiveExpr
[25]    AdditiveExpr    ::=    MultiplicativeExpr



| AdditiveExpr '+' MultiplicativeExpr



| AdditiveExpr '-' MultiplicativeExpr
[26]    MultiplicativeExpr    ::=    UnaryExpr



| MultiplicativeExpr MultiplyOperator UnaryExpr



| MultiplicativeExpr 'div' UnaryExpr



| MultiplicativeExpr 'mod' UnaryExpr
[27]    UnaryExpr    ::=    UnionExpr



| '-' UnaryExpr

Expression Lexical Structure
[28]    ExprToken    ::=    '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::'



| NameTest



| NodeType



| Operator



| FunctionName



| AxisName



| Literal



| Number



| VariableReference
[29]    Literal    ::=    '"' [^"]* '"'



| "'" [^']* "'"
[30]    Number    ::=    Digits ('.' Digits?)?



| '.' Digits
[31]    Digits    ::=    [0-9]+
[32]    Operator    ::=    OperatorName



| MultiplyOperator



| '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>='
[33]    OperatorName    ::=    'and' | 'or' | 'mod' | 'div'
[34]    MultiplyOperator    ::=    '*'
[35]    FunctionName    ::=    QName - NodeType
[36]    VariableReference    ::=    '$' QName
[37]    NameTest    ::=    '*'



| NCName ':' '*'



| QName
[38]    NodeType    ::=    'comment'



| 'text'



| 'processing-instruction'



| 'node'




| 'point'



| 'range'
[39]    ExprWhitespace    ::=    S

The xpointerlib project can be contacted through the mailing list or the member list.
Copyright © 2000-2017. All rights reserved. Terms of Use & Privacy Policy.