Thx David.. Because I use a Xalan sample code - SimpleXPathAPI, I don't another exception information. And, I have installed an ErrorHandler instance in the parser with DOMCountErrorHandler. In XML Signature specifications, Namespace URI is "http://www.w3.org/2000/09/xmldsig#" and Namespace prefix is "dsig". I use a XercesDOM because I modify DOM. I used two XercesDOMSupport instances -- that's my mistake. And the value from theDocument->getDocumentElement() is not NULL. My edited code is below.
----------------------------------------- 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; DOMCountErrorHandler errorHandler; parser->setErrorHandler(&errorHandler); parser->setValidationScheme(valScheme); parser->setDoNamespaces(doNamespaces); parser->setDoSchema(doSchema); parser->setExternalSchemaLocation(strSchema) ; parser->setValidationSchemaFullChecking(schemaFullChecking); parser->parse(xmlFile); DOM_Document doc = parser->getDocument() ; XercesDOMSupport theDOMSupport ; XercesParserLiaison theLiaison(theDOMSupport) ; XalanDocument* theDocument = theLiaison.createDocument(doc) ; XPathEvaluator theEvaluator; XalanNode* const theContextNode = theDocument->getDocumentElement() ; const char* xpathstr = "(//* | //@* | //namespace::*)" ; // <- enveloped signature const XObjectPtr result = theEvaluator.evaluate(theSupport, theContextNode, XalanDOMString(xpathstr).c_str(), theContextNode) ; // <-- throw exception const NodeRefList nl(result->nodeset()) ; for(int i=0 ; i<nl.getLength() ; ++i) { char* selectStr = "/ancestor-or-self::dsig:Signature" ; XalanNode* node = nl.item(i) ; XPathEvaluator eval ; const XObjectPtr resutlPtr = eval.evaluate(theDOMSupport, node, XalanDOMString(selectStr).c_str(), node) ; // <-- throw exception .............. } ........
