Ramon,
you are casting a string to be an XMLCh string, and that would place
garbage in the XPath expression. Try using
XMLCh* xpathStr = XMLString::transcode("//root/table/size");
followed by an XMLString::release(&xpathStr) at the end.
Alberto
On 4/9/2010 9:30 PM, Ramon F. Herrera wrote:
On 4/9/2010 2:18 PM, Ramon F. Herrera wrote:
Can I use Xerces-C to perform XPath searches on an XML file by itself?
I don't have a corresponding schema, don't know how to make one and my
XML files are rather large and somewhat complex.
TIA,
-Ramon
This is my code:
DOMDocument* doc = parser->parseURI(xmlFile);
DOMElement* elem = doc->getDocumentElement();
XMLCh* xpathStr = (XMLCh*) "//root/table/size";
DOMNode* node = (DOMNode*) elem;
DOMXPathResult* result = doc->evaluate(xpathStr, node, NULL,
DOMXPathResult::ANY_TYPE, NULL);
cout<< "result: "<< result<< endl;
...and this is the error message I am getting:
Exception message is:
expression has incorrect syntax or contains XPath features not
supported by the XML Schema XPath subset
-Ramon