Skip to content

Commit

Permalink
Fix first level matching (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Dec 11, 2019
1 parent 218c6a5 commit 1ca52c6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/xml/xpath/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var _GPF_XML_XPATH_TOKEN = {};
]));

// <start> -> <level> (CONCAT <level>)?
// <level> -> CURRENT? (SUB|DEEP) <match> ( (SUB|DEEP) <match> )*
// <level> -> (CURRENT? (SUB|DEEP))? <match> ( (SUB|DEEP) <match> )*
// <match> -> ATTRIBUTE? NAMESPACE_PREFIX? (NAME|ANY)

/**
Expand Down Expand Up @@ -121,7 +121,16 @@ function _gpfXmlXPathParse (xpathExpression) {
chain = new _GpfXmlXPathChain(),
subOrDeep,
operator;
subOrDeep = checkAndConsumeIfTokenMatch(_GPF_XML_XPATH_TOKEN.SUB, _GPF_XML_XPATH_TOKEN.DEEP);
subOrDeep = consumeIfTokenMatch(_GPF_XML_XPATH_TOKEN.SUB, _GPF_XML_XPATH_TOKEN.DEEP);
if (!subOrDeep) {
if (relative) {
gpf.Error.invalidXPathSyntax();
}
relative = true;
subOrDeep = {
token: _GPF_XML_XPATH_TOKEN.SUB
};
}
while (subOrDeep) {
operator = new levelClasses[subOrDeep.token](relative);
operator.addChild(match());
Expand Down

0 comments on commit 1ca52c6

Please sign in to comment.