There is new functionality to work with the DOM using the XalanTransformer.
You can get it by checking out the latest code from the CVS repository.
Otherwise, you can wait until the next release, when it will be included
with the distribution. For more information, you can search the bug
database.
In general, it's a bad idea to use the Xerces DOM for transformations.
Depending on the size of the document, and the nature of your stylesheets,
using the DOM can be up to an order of magnitude slower and have much
higher memory requirements. Unless you have some specific need to use the
DOM, don't do it -- let Xalan build its own source tree.
Dave
Matthew James
Hanson To:
[email protected]
<matthew.hanson@ cc: (bcc: David N
Bertoni/CAM/Lotus)
wcom.com> Subject: Type:RuntimeException,
Message:The primary document
entity could not be opened.
Id={null}
12/03/2001 12:18
PM
Hi!
We are trying to use XalanC++ to tranform XML docs to FO. I am beginning
to
test the library, and using non-DOM XSLTInputSource objs as the XML
parameter to the XalanTransformer works just fine. However, an exception
is
thrown when I use the following code, hoping to use DOM as an input source:
XMLPlatformUtils::Initialize();
XalanTransformer::initialize();
XalanTransformer theXalanTranformer;
DOMParser theParser;
theParser.setToCreateXMLDeclTypeNode(false);
theParser.parse("foo.xml");
const DOM_Document theDOM = theParser.getDocument();
XercesDOMSupport theDOMSupport;
XercesParserLiaison theParserLiaison(theDOMSupport);
XalanDocument * theDoc =
theParserLiaison.createDocument(theDOM);
XSLTInputSource xmlIn(theDoc);
XSLTInputSource xslIn("foo.xsl");
std::ostringstream strm;
XSLTResultTarget xmlOut(strm);
int theResult = theXalanTranformer.transform(xmlIn, xslIn,
xmlOut);
This sample code is very similar to the usage patterns at xml.apache.org.
Please help! I am also interested in information on performance issues
when
using DOM XML input to the XalanTransformer. There is a caveat in the
documentation that seems to recommend against using the DOM. Is file based
input preferred, and if so, how much faster?
Thanks!
Matt Hanson!