Hi,
 
I am very new to Xerces and Xalan.
I am using Xerces 2.1.0 and Xalan 1.4.0.
 
Based on one of the examples given on the Apache site, I wrote the below given simple code and got the following error message while transforming a XalanDocument.
I am getting -2 as a result of XalanTransformer::tranform() method.
 
Error msg:
Fatal Error at (file <unknown>, line 0, column 0): An exception occurred!
Type:RuntimeException, Message:The primary document entity could not be
opened. Id={null}
theResult = -2
 
Could someone give me pointers as to why this error is caused. A speedy reply would be highly appreciated.
Thanks in advance.
 
The code:
**************************************************************************
// Use the Xerces DOM parser to create a DOM_Document.
#include <parsers/DOMParser.hpp>
#include <dom/DOM_Node.hpp>
DOMParser  theParser;
// You MUST instruct the Xerces DOMParser NOT to create a DOM_XMLDecNode
// in the DOM to represent the XML declaration. See "Limitations" below.
DOMParser::setToCreateXMLDeclTypeNode(false);
theParser.parse("foo.xml");
const DOM_Document theDOM = theParser.getDocument();
// Set up a XercesParserLiaison and use it to wrap the DOM_Document
// in a XalanDocument.
XercesDOMSupport   theDOMSupport;
XercesParserLiaison theParserLiaison(theDOMSupport);
XalanDocument* theDoc = theParserLiaison.createDocument(theDOM);
// Use the XalanDocument to create an XSLTInputSource object, which
// you can then use in a transformation.
XSLTInputSource  theInputSource(theDoc);
XSLTInputSource theXSLInput("foo.xsl");
XSLTResultTarget theOutput("foo.out");
XalanTranformer::intialize();
XalanTransformer theTransformer
int theResult =
theTransformer.transform(theInputSource,theXSLInput,theOutput);
cout << "theresult is: " << theResult ;

****************************************************************************



Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.

Reply via email to