Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-2127

XPath: XPath_TokenNotSupported thrown when evaluating correct [28] ExprToken

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.2.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      The following code:

      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;
      }
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Wexiwa Maxime Vinci
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: