Hi, all.
I want to get the special
element.
I have that xml
file.
-------------------------
<?xml ....
?>
<dsig:Signature
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
<dsig:SignedInfo
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
....
</dsig:Signature>
--------------------------
And, I get the 'Signature' element.
So I use the xpath _expression_ like this,
"/descendant-or-self::dsig:Signature"
But, My app throws a exception.
My code..
---------------------------------------------
char* strSchema = "http://www.w3.org/2000/09/xmldsig#
D:\\xmldsig.xsd" ;
DOMParser* parser = new DOMParser;
DOMParser::ValSchemes valScheme = DOMParser::Val_Always;
bool doNamespaces = true;
bool doSchema = true;
bool schemaFullChecking = true;
DOMParser* parser = new DOMParser;
DOMParser::ValSchemes valScheme = DOMParser::Val_Always;
bool doNamespaces = true;
bool doSchema = true;
bool schemaFullChecking = true;
parser->setValidationScheme(valScheme);
parser->setDoNamespaces(doNamespaces);
parser->setDoSchema(doSchema);
parser->setExternalSchemaLocation(strSchema) ;
parser->setValidationSchemaFullChecking(schemaFullChecking);
parser->setDoNamespaces(doNamespaces);
parser->setDoSchema(doSchema);
parser->setExternalSchemaLocation(strSchema) ;
parser->setValidationSchemaFullChecking(schemaFullChecking);
parser->parse(xmlFile);
DOM_Document doc =
parser->getDocument() ;
XercesDOMSupport* support = new XercesDOMSupport() ;
XercesDOMSupport theDOMSupport ;
XercesParserLiaison theLiaison(theDOMSupport) ;
XercesDOMSupport* support = new XercesDOMSupport() ;
XercesDOMSupport theDOMSupport ;
XercesParserLiaison theLiaison(theDOMSupport) ;
XalanDocument* theDocument = theLiaison.createDocument(doc)
;
XPathEvaluator theEvaluator;
XalanNode* const theContextNode = theDocument->getDocumentElement() ;
const char* xpathstr = "/descendant-or-self::dsig:Signature" ;
XalanNode* const theContextNode = theDocument->getDocumentElement() ;
const char* xpathstr = "/descendant-or-self::dsig:Signature" ;
const XObjectPtr result
= theEvaluator.evaluate(*support,
theContextNode,
XalanDOMString(xpathstr).c_str(),
theContextNode) ; // <-- throw exception
.....................
.....................
