Hi Gary,
If you look in the scratchpad area of the source (src\scratchpad\webapp\samples\castor) there is an example of how to do a Castor transformation.
Keith.
-----Original Message-----
From: Howard, Gary [mailto:[EMAIL PROTECTED]]
Sent: 21 March 2003 14:09
To: '[EMAIL PROTECTED]'
Subject: Castor and Cocoon
I have a Java object that I am trying to turn into XML in my custom
generator class. I am trying to use Castor to do this. I am not sure how
to integrate Castor into the generator class. My concern is how I set the
ContentHandler. Does anyone have any input. There was not much on the web
about this.
Thanks,
Gary
Custom generator:
public void generate() throws SAXException, IOException
{
try
{
ClaimActivity claim = new ClaimActivity();
claim.setInsuredName("Joe Shmoe");
// the org.xml.sax.ContentHandler is inherited
// through org.apache.cocoon.xml.AbstractXMLProducer
Marshaller.marshal(new ClaimActivity(), contentHandler);
}
catch (ValidationException valex)
{
valex.printStackTrace();
}
catch (MarshalException marex)
{
marex.printStackTrace();
}
}
Her is the error that I am getting:
<Mar 21, 2003 9:03:03 AM EST> <Error> <HTTP> <101017>
<[ServletContext(id=546240
3,name=cocoon,context-path=/cocoon)] Root cause of ServletException
java.lang.NoClassDefFoundError: org/apache/xml/serialize/XMLSerializer
at org.exolab.castor.xml.Marshaller.initialize(Marshaller.java:383)
at org.exolab.castor.xml.Marshaller.<init>(Marshaller.java:329)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:665)
at COPRGenerator.generate(COPRGenerator.java:43)
at
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(Ca
chingEventPipeline.java:258)
at
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(C
achingStreamPipeline.java:412)
at
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invo
ke(SerializeNode.java:148)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNo
de.invokeNodes(AbstractParentProcessingNode.java:84)
at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNod
e.invoke(PreparableMatchNode.java:164)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNo
de.invokeNodes(AbstractParentProcessingNode.java:108)
at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode..invok
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
******************************************************************************** This electronic mail system is used for information purposes and is not intended to form any legal contract or binding agreement. The content is confidential and may be legally privileged. Access by anyone other than the addressee(s) is unauthorised and any disclosure, copying, distribution or any other action taken in reliance on it is prohibited and maybe unlawful All incoming and outgoing e-mail communications and attachments are scanned automatically by software designed to detect and remove any material containing viruses or other unauthorised content. While we undertake best endeavours to ensure that this content checking software is up to date, recipients should take steps to assure themselves that e-mails received are secure. ********************************************************************************