$)C Without any information regarding the exception, it's hard to say what my be going wrong here, but it coule be that Xalan cannot determine the namespace for the prefix "dsig".
Also, you have not installed an ErrorHandler instance in the parser, so there may be problems parsing your document. In particular, the URI you're using for the schema location looks broken. Are you really expecting the parser to find a schema instance at this URI? "http://www.w3.org/2000/09/xmldsig# D:\\xmldsig.xsd" ; I also don't understand why you have two XercesDOMSupport instances -- that's completely broken. A little debugging with the value return from theDocument->getDocumentElement() should tell you whether or not you have a broken document. Dave [EMAIL PROTECTED] <[EMAIL PROTECTED] To: <[email protected]> ity.com> cc: (bcc: David N Bertoni/Cambridge/IBM) Subject: XPath with namespaces 07/01/2002 02:18 AM Please respond to freeman 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; parser->setValidationScheme(valScheme); 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) ; XalanDocument* theDocument = theLiaison.createDocument(doc) ; XPathEvaluator theEvaluator; 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 .....................
