--- Mocky Habeeb said ---
Tue, 11 Oct 2005 07:29:57 -0700

Currently I'm using the org.jibx.extras.Dom4JElementMapper to handle
content of that type. But I don't like including the 400k+ dom4j jar
file for the sole purpose of storing some embedded HTML (in my case)
content in a String. I'd be interested to see different solutions others
may have.

Mocky
-------------------------

Hi Mocky,

I'm planning to use org.jibx.extras.DomElementMapper and leverage the
JRE's support for org.w3c.dom.Document and then (because we already use
it internally) convert that to JDOM (the JDOM 1.0 jar is ~150kb).  JDOM
provides a org.jdom.input.DOMBuilder helper class for this sort of
thing.  Something like this, if w3cDocument is the source
org.w3c.dom.Document instance provided by the JiBX extras unmarshaller:

org.jdom.input.DOMBuilder builder = new org.jdom.input.DOMBuilder();
org.jdom.Document jdomDocument = builder.build(w3cDocument);

Another idea I had earlier, but have not tried yet, is to create a
custom marshaller/unmarshaller that does the following:

  Unmarshalling:  convert parse events into String (essentially
re-marshal it)
  Marshalling:  simply output the String of XML that the Unmarshaller
created.

This would handle the case you mention above for embedded HTML --
provided it is well-formed (since it must pass through the parser).
This sounds like a generally useful sort of utility where there are
extensibility points in your XML which cannot be fully known/specified
in advance but must be preserved.

Regards,

...Leif


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to