Hello,
unfortunately I can't help, but I have the same problem.
I'm creating a Xerces DOM which is being used as input for
XalanTransformer.transform(), very similar to what Arnaud does.
This used to work with Xalan C++ 1.1 but it doesn't
work using Xalan C++ 1.2.
After some debugging without success, I'm serializing the DOM to
a stream and transform from there. Of course, this is kind of a
work-around, but it works.
I traced the problem down to:
BinInputStream* XSLTInputSource::makeStream() const
which doesn't create a stream and therefore causes the exception.
However, I'm using Xalan only for a short time, and I don't even know
if this function is supposed to create a stream for the DOM.
Any explanation what's going on here would be greatly appreciated.
Thanks a lot,
Achim
-----Original Message-----
From: Arnaud Malguy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 1:32 PM
To: xalan-dev
Subject: XalanTransfomer with DOM input
Hello,
I use Xalan C++ 1.2 and i'm trying to implement a sequence of transformation
with DOM intermediate result.
For this, i need to use XalanDocument as input of XalanTransfomer::transform
method.
It seems to not work in my complete code then i create a basic sample which
don't work too.
I got the following error :
Fatal Error at (file , line 0, column 0): An exception occured!
Type:RuntimeException, Message:The primary document entity could not be
opened. Id={null}
Could someone help me to correct the following code ?
XMLPlatformUtils::Initialize();
XalanTransformer::initialize();
XercesDOMSupport domSupport;
XercesParserLiaison parserLiaison(domSupport);
XalanTransformer xalanTransformer;
XSLTInputSource input_source("test_in.xml");
XSLTResultTarget output_result("test_out.xml");
XSLTInputSource xslt_source("test.xslt");
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.
theParser.setToCreateXMLDeclTypeNode(false);
theParser.parse("test_in.xml");
const DOM_Document theDOM = theParser.getDocument();
XalanDocument* theDoc = parserLiaison.createDocument(theDOM);
XSLTInputSource input_dom_source(theDoc);
// WORK
xalanTransformer.transform(input_source, xslt_source, output_result);
// Don't WORK
xalanTransformer.transform(input_dom_source, xslt_source, output_result);
XalanTransformer::terminate();
XMLPlatformUtils::Terminate();
Thanks a lot.
Arnaud Malguy