John,
I just had a close look, and it looks like this property cannot be set
programmatically, as Castor internally handles instantiation of an
XMLNaming instance way before this property is (re)set.
Sorry for the bad news, but I am not in a position to provide you with a
quick fix.
Regards
Werner
John Huss wrote:
> What is the proper way to set the XML_NAMING property programmatically,
> without a properties file?
>
> I have this code:
>
> public static User unmarshalUser(final java.io.Reader reader)
> throws MarshalException, ValidationException {
>
> XMLContext context = new XMLContext();
> context.setProperty(XMLConfiguration.XML_NAMING,
> "com.ics.xml.MixedCapitalizedXMLNaming");
>
> Unmarshaller unmarshaller = context.createUnmarshaller();
> unmarshaller.setClass(User.class);
> User user = (User) unmarshaller.unmarshal(reader);
> return user;
> }
>
> It doesn't work because the XML_NAMING property is not being set properly.
> If I comment out the line
>
> //context.setProperty(XMLConfiguration.XML_NAMING,
> "com.ics.xml.MixedCapitalizedXMLNaming");
>
> And add a castor.properties file with the line:
>
> org.exolab.castor.xml.naming=com.ics.xml.MixedCapitalizedXMLNaming
>
> Then it works.
>
> Thanks for your help,
> John
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email