Whats the best way to perform marshalling from Objects to XML within XSP's?
The Object is a result from a Castor OQL-Query.
Here's an example what I'd like to intend:
<some-items anAttr="aVal">
<xsp:logic>
marshalObjToXml(model.getAnItem());
</xsp:logic>
</some-items>
I've experimented in vain with the following approaches:
1. Include Object as String:
<xsp:page
language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:cinclude="http://apache.org/cocoon/include/1.0"
xmlns:util="http://apache.org/xsp/util/2.0"
>
<some-items anAttr="aVal">
<util:include-expr>
<xsp:expr>model.getAnItemAsString()</xsp:expr>
</util:include-expr>
</some-items>
</some-items>
</xsp:page>
The page does not compile. The method .getAnItemAsString is not even
executed.
2.
Use Castor's marshalling capabilities:
<some-items anAttr="aVal">
<xsp:logic>
model.marshal(this.contentHandler);
</xsp:logic>
</some-items>
Within the method I pass the contentHandler (wrapped into
DocumentHandlerAdapter) to castor's marshaller before I perfom mashal(obj).
As A result the cinclude transformer (which I need) complains about a
Nullpointer exception.
Does anyone have a better Idea? Examples are welcome.
Harald
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>