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?
regards, Christoph [EMAIL PROTECTED]
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 view.
(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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
