Ovanes Markarian wrote:
It's very difficult, as the implementation is optimized to be read-only,
and there is not a lot of flexibility during construction.
You might take a look at the class XalanSourceTreeContentHandler to see how
it works in response to SAX2 events.
My problem is, that I have to deal with transformed documents which result in
data structures and
sometimes I have to recreate from data structures the XalanDocument and
probably serialize it.
I do it through a visitor implementation. And somehow I don't like the idea
either going back to
Xerces, since my entire app relies only on Xalan (I know that Xalan relies on
Xerces...) and using
Xerces would increase code complexity.
I will investigate if I can use sax within my visitor implementation. But on
the other hand I also
looked in the XercesDocumentBrige class and it can be used to create nodes via
DOM methods, but it
is Deprecated...
Yes, but the Wrapper classes are not deprecated. The Bridge classes are
deprecated because they are built around the old Xerces-C DOM, which was
deprecated a while ago. However, it's still better to use the default
source tree, since processing is much more efficient that way.
It's probably best for you to try to map your visitor class to the SAX2
event-based model, since that will let you build an instance of the default
source tree with minimal extra code on your part.
Dave