You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by "Xiao, Ke" <kx...@microstrategy.com> on 2002/07/30 23:07:44 UTC

How to use DocumentBuilder?

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,