commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Gaffga (" <>
Subject Re: [Betwixt] Beans containing XML
Date Tue, 22 Mar 2005 14:23:11 GMT

I'm also looking for a solution to output properties that implement 
org.w3c.dom.Node as XML via betwixt. For example if we have a 
Article-bean having properties such as headline, author etc. and one 
property xhtmlContent of type Node, we would like to output this 
property with the structure that is decribed by the DOM node.

I was looking around a bit, but not sure where to extend betwixt for 
such behaviour.

my test code looks like:

     public void testXmlElementOutput() {
         try {
             Attributes atts = new AttributesImpl();
             SAX2DOM handler = new SAX2DOM();
             handler.startElement("", "test", "test", atts);
             handler.startElement("", "test2", "test2", atts);
             handler.endElement("", "test2", "test2");
             handler.endElement("", "test", "test");
             Node document = handler.getDOM();
             Node node = document.getFirstChild();
             System.out.println("Node: " + node.getLocalName());
         } catch (Exception e) {

so I would expect some output like:

Perheaps anybody can give me some hint on how to implement this in 
betwixt. I'm not sure wether I should do this in the introspector or 
better simply check in writeBean-method if the Node interface is 
implemented by this bean and then output the DOM tree. Seems a little 
bit to straight forward for me, it's not pluggable and not extendable.

Any Ideas?


Frédéric Desmoulins wrote:
> Sorry I misunderstood,
> My DOM element should be represensented as the right XML structure
> representing this DOM element.
> i.e:
> myElement = doc.createElement("myElem");
> ...
> Should output:
> <myElement>
> 	<myElem />
> </myElement>
> Thanks,
> fred
> Le jeudi 17 mars 2005 à 23:03 +0000, robert burrell donkin a écrit :
>>On Thu, 2005-03-17 at 22:56 +0100, Frédéric Desmoulins wrote:
>>>Hi Robert,
>>>Actually I'm mapping beans to XML (that can contain XML attributes) and
>>>I do not care to reverse it because resulting XML is a 'final' data
>>>representation that is going through an XSLT processor to produce a
>>(sorry for not being a little clearer)
>>you have a bean with an property whose value is a DOM element, right?
>>how should that property be mapped? 
>>(in other words, what output do you want)
>>- robert

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message