Hi Harald, Have a look at: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12993 it contains a pretty nasty workaround for the problem and works with castor-0.9.4. If you find a better solution please let us know.
Right now I am working on a new version of the transformer that can use input and outputmodules to store and retrieve to objects to marshall or the unmarshalled objects. HTH, Michael -----Original Message----- From: Harald Wehr To: [EMAIL PROTECTED] Sent: 23-1-2003 12:18 Subject: Castor Transformer I am using a Cocoon-Developer-Snapshot from October this year. The Castor Transformer i fetched from CVS. Unfortunately this class uses a lot of deprecated stuff. Additionally i have to serialize a java-object stored in my xmlform. So i tried to write my own transformer. The code is attached here. The Castor Marshaller needs a Sax-ContentHandler that I get by calling the variable "contentHandler", available in the transformer. Following Exception do I get. Do I have to set the Sax-Parser in the Properties? When I set the Sax-Parser from cocoon.xconf additionally in the properties i get a ClassNotFoundException. When i replace the deprecated Classes from the CVS-transformer same things happen. Any help is appreciated. Harald ------------Exception-------------------- org.xml.sax.SAXException: System property org.xml.sax.parser not specified at org.xml.sax.helpers.ParserAdapter.<init>(ParserAdapter.java:104) at org.exolab.castor.xml.Marshaller.<init>(Unknown Source) at de.mobiharz.cocoon.transformation.MobiHarzXMLFormTransformer.startElemen t(MobiHarzXMLFormTransformer.java:45) at org.apache.cocoon.xml.AbstractXMLPipe.startElement(AbstractXMLPipe.java: 130) at org.apache.cocoon.transformation.AbstractSAXTransformer.startElement(Abs tractSAXTransformer.java:340) at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXPars er.java:459) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Abstrac tXMLDocumentParser.java:221) at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNamespac eBinder.java:874) at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamespaceBinde r.java:591) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:747) ... ----------Transformer--------------------- package de.mobiharz.cocoon.transformation; import org.apache.cocoon.components.xmlform.Form; import org.apache.cocoon.transformation.XMLFormTransformer; import org.apache.commons.jxpath.JXPathContext; import org.exolab.castor.xml.Marshaller; import org.xml.sax.AttributeList; import org.xml.sax.Attributes; import org.xml.sax.HandlerBase; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; import de.mobiharz.model.buchungen.Unterkunft; public class MobiHarzXMLFormTransformer extends XMLFormTransformer { public void startElement( String namespaceURI, String localName, String qName, Attributes attributes) throws SAXException { if (namespaceURI.equals("") && localName.equals("xmlformergebnis")) { try { String formName = attributes.getValue("xmlform-id"); String objectPath = attributes.getValue("xpath"); Form form = Form.lookup(objectModel, formName); JXPathContext context = JXPathContext.newContext(form.getModel()); Object o = context.getValue(objectPath); // System.out.println(o); super.startElement( "", "xmlformergebnis", "xmlformergebnis", attributes); Marshaller marshaller = new Marshaller(contentHandler); Unterkunft u = (Unterkunft)o; marshaller.marshal(o); } catch (Exception e) { e.printStackTrace(); super.startElement( "", "xmlformergebnis", "xmlformergebnis", attributes); } } else super.startElement(namespaceURI, localName, qName, attributes); } public void endElement(String namespaceURI, String localName, String qName) throws SAXException { if ((namespaceURI != null)) { if (namespaceURI.equals("") && localName.equals("xmlformergebnis")) super.endElement("", "xmlformergebnis", "xmlformergebnis"); else super.endElement(namespaceURI, localName, qName); } } } --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]> --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>