[XOM-interest] StaX/DOM/SAX-to-XOM bridge

Dmitry Katsubo dma_k at mail.ru
Tue Sep 14 11:11:49 EDT 2010


Dear XOM users!

I want to benefit from quick StaX/DOM/SAX -to- XOM document creation,
but I was not able to locate any way to do so. Actually, my target API I
want to bind with is javax.xml.bind.Marshaller.marshal(), that accepts
javax.xml.transform.Result, org.xml.sax.ContentHandler or
javax.xml.stream.XMLStreamWriter as possible outputs.

Unfortunately, nu.xom.xslt.XOMResult is not visible, so does
nu.xom.XOMHandler. And there is no XMLStreamWriter -to- NodeFactory
bridge. More over I cannot copy XOMHandler to my package, as
Element.setActualBaseURI(), Node.isElement(), etc are not public. Does
it mean I cannot write my own ContentHandler to create XOM document?

The same concerns DOM-to-XOM converters. What I found is only XOM-to-DOM
nu.xom.converters.DOMConverter.

If somebody has ready-to-use adapters, please, share them. At the moment
I found this [1] discussion with this [2] code example, that reads from
javax.xml.stream.XMLStreamReader and creates XOM document.

I would appreciate, if something similar to following code snapshot
would be possible via core XOM:

final nu.xom.xslt.XOMResult result = new nu.xom.xslt.XOMResult(); //
default constructor that creates new NodeFactory() for me
marshaller.marshal(bean, result);
nu.xom.Document doc = result.getDocument();

Any feedback is very welcomed.

[1] http://lists.ibiblio.org/pipermail/xom-interest/2005-August/002563.html
[2]
http://lists.ibiblio.org/pipermail/xom-interest/2005-September/002617.html

-- 
With best regards,
Dmitry



More information about the XOM-interest mailing list