Yes, XalanDocumentBuilder _only_ supports building a document through SAX2
calls. That's the only way you can use Xalan's internal source tree
implementation, which is what XalanDocumentBuilder uses for its
implementation.
If you really must use DOM calls, you can use the Xerces DOM interfaces,
then follow this usage pattern to do a transformation:
http://xml.apache.org/xalan-c/usagepatterns.
html#xercesdomwrapperparsedsource
However, be prepared for longer transformation times and greater memory
usage.
Dave
"Xiao, Ke"
<[EMAIL PROTECTED] To:
"'[email protected]'" <[email protected]>
tegy.com> cc: (bcc: David N
Bertoni/Cambridge/IBM)
Subject: How to use
DocumentBuilder?
07/30/2002 02:07
PM
Hi,all
I want to use DocumentBuilder to create a Xalan Document for transform, but
it always fails.
My code is like:
XalanTransformer theXalanTransformer;
// Get a document builder from the transformer...
XalanDocumentBuilder* const theBuilder = theXalanTransformer.
createDocumentBuilder();
XalanDocument *lpDoc = theBuilder->getDocument();
When I try to use lpDoc to create any XalanElement or other nodes, it
always fails.
I debug the code and find that the lpDoc is a XalanSourceTreeDocument
class, all creatXXX methods in that class are not supported and throw an
exception.
There is a DocumentBuilder sample in Xalan, but it use SAX2 ContentHandler
from the DocumentBuilder to create the document.
Does this mean that DocumentBuilder only support SAX2 content handler , but
do not support any DOM here?
Do I have any other ways to solve this?
Thanks a lot,