Maxime Vinci created XERCESC-2127:
-------------------------------------

             Summary: XPath: XPath_TokenNotSupported thrown when evaluating 
correct [28] ExprToken
                 Key: XERCESC-2127
                 URL: https://issues.apache.org/jira/browse/XERCESC-2127
             Project: Xerces-C++
          Issue Type: Bug
          Components: DOM, Validating Parser (XML Schema)
    Affects Versions: 3.2.0
            Reporter: Maxime Vinci


The following code:

{code:java}
std::unique_ptr<XercesDOMParser> parser(new XercesDOMParser());
/** init **/
DOMDocument *doc = (*parser).getDocument();
XMLCh* xpathStr=XMLString::transcode("/root/foo[@id=\"123\"]");
DOMElement* root = doc->getDocumentElement();
try
{
    DOMXPathNSResolver* resolver=doc->createNSResolver(root);
    DOMXPathResult* result=doc->evaluate(
                xpathStr,
                root,
                resolver,
                DOMXPathResult::ORDERED_NODE_SNAPSHOT_TYPE,
                NULL);

   result->release();
    resolver->release();
}
catch(const DOMXPathException& e)
{
    XERCES_STD_QUALIFIER cerr << "Error:"
                              << XERCES_STD_QUALIFIER endl
                              << StrX(e.getMessage()) << XERCES_STD_QUALIFIER 
endl;
}
{code}

Results in an exception *XPath_TokenNotSupported* being thrown from 
*XPathScannerForSchema::addToken*. The latest being called in 
*XPathScanner::scanExpression*.

The *XPathScannerForSchema* object is created in *XercesXPath::parseExpression*.

I don't know if this is an unwanted behavior as the XPath expression is valid 
according to [https://www.w3.org/TR/xpath/#path-abbrev] or if the XPath parsing 
ins't fully implemented and this syntax isn't supported yet (therefore this 
issue should rather be an improvement request). Anyway this is a bit annoying.




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to