I am trying to programmatically set some of the castor properties to customize the XML marshalling behavior and it does not seem to work. Code snippet and output are included below.
I am using Casto 1.2 and based on this document, http://www.castor.org/1.3/xml-properties.html#Current-configuration-file, my understanding is that it should work: As of Castor 1.1, it is possible to read and set the value of properties programmatically using the getProperty(String) and setProperty(String,String) on the following classes: - org.exolab.castor.xml.Unmarshaller - org.exolab.castor.xml.Marshaller - org.exolab.castor.xml.XMLContext Whilst using the setter methods on the first two classes will change the settings of the respective instances only, using the setProperty() method on the XMLContext class will change the configuration globally, and affect all Unmarshaller and Marshaller instances created thereafter using the createUnmarshaller() and createMarshaller() methods. I also tried to set the property at the XMLContext level, no success. The only I am able to make it work is with a castor.properties file in the classpath. Am I missing something obvious? I did not try Castor 1.3 as I have a hard requirement for JRE 1.4 support. Op1Request op = new Op1Request(); op.setArg1(12345); Marshaller marshaller = new Marshaller(new OutputStreamWriter(System.out)); marshaller.setProperty("org.exolab.castor.xml.introspector.primitive.nodetype", "element"); marshaller.setProperty("org.exolab.castor.xml.naming", "mixed"); marshaller.setProperty("org.exolab.castor.indent", "true"); marshaller.marshal(op); And I get the following output showing that the properties are not taken into account: <?xml version="1.0" encoding="UTF-8"?> <op1-request arg1="12345"/> --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

