On Tue, 2005-03-22 at 15:23 +0100, Christoph Gaffga (triplemind.com)
wrote:
> hi,
> 
> 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.startDocument();
>              handler.startElement("", "test", "test", atts);
>              handler.startElement("", "test2", "test2", atts);
>              handler.endElement("", "test2", "test2");
>              handler.endElement("", "test", "test");
>              handler.endDocument();
>              Node document = handler.getDOM();
>              Node node = document.getFirstChild();
>              System.out.println("Node: " + node.getLocalName());
>              betwixt(node);
>          } catch (Exception e) {
>              e.printStackTrace();
>              fail(e.getMessage());
>          }
>      }
> 
> so I would expect some output like:
> <test>
>    <test2/>
> <test>
> 
> 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?

a good question :)

DOM support seems like a good idea. 

experience has taught me that adding extra special case logic into the
write bean method usually causes difficulties in the long run. support
for dyna-beans is reasonably unobtrusive and i wonder whether DOM could
be supported in the same fashion. 

(i'm pretty tied up with JCL work right now so apologies if i'm slow in
replying. i will try to keep up a bit better next week)

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to