Hi, I'am allready using the castortransformer for a while. This is the version Michael Homeijer posted. This version worked with pre and post processing options for the marshalling of objects. Because of the need for a castorcommand, it was not posible to set sitemap parameters for the use of navigation like with Cocoon Actions.
To be brief I wanted to use castor in combination with actions. So i did some debugging on the castortransformer shipped in the scratchpad. I found the following issues. The test.xml file is out dated: - the latest version of the castor transformer uses marshal and unmarshal instead of InsertBean -the castor namespace must be: http://apache.org/cocoon/castor/1.0 The test.xml should look like this: <?xml version="1.0"?> <zoo xmlns:castor="http://apache.org/cocoon/castor/1.0"> <castor:marshal name="Mouse"/> <castor:marshal name="Lion"/> <castor:marshal name="Hamster" mapping="castor-mappings/test- mapping_de.xml"/> <castor:marshal name="Wale"/> <castor:marshal name="Elefant" scope="session"/> <castor:marshal name="Elefant" scope="request"/> </zoo> The the Marshall class gives an exception that the system property for the sax parser is not set. You can do this by setting the Systemproperty org.xml.sax.parser when you startup your web or app server. Or you can use the static block together with the method xmlParserFoundAndSet in the castor transformer. The code of the two is below. I will post the complete java and xml files later this week, but it will work if you do as described above. Regards Erwin. // Static initializer: static { // Try to find out which XML parser to use: // FIXME: This should be a Cocoon parser. if (xmlParserFoundAndSet ("org.apache.xerces.parsers.SAXParser")) { // Xerces / XML4J } else if (xmlParserFoundAndSet ("org.apache.crimson.jaxp.SAXParserImpl")) { // Crimson } else if (xmlParserFoundAndSet ("com.jclark.xml.sax.Driver")) { // James Clark XP } else if (xmlParserFoundAndSet ("com.microstar.xml.SAXDriver")) { // Aelfred } else { System.err.println("ERROR: No SAX XML parser found!"); } } /** * Code to specify the appropriate parser. * * @param qualifiedName DOCUMENT ME! * * @return DOCUMENT ME! */ private static boolean xmlParserFoundAndSet(String qualifiedName) { try { Class.forName(qualifiedName, false, Thread.currentThread().getContextClassLoader()); } catch (ClassNotFoundException cnfe) { return false; } System.setProperty("org.xml.sax.parser", qualifiedName); System.out.println("Using SAX XML parser: " + qualifiedName); return true; }
