Is there a way to reference a properties file other than by adding it to the classpath?
John On Wed, Jan 14, 2009 at 3:49 PM, Werner Guttmann <[email protected]>wrote: > John, > > feel free to do so. Though by the looks of it, a patch for this issue > will need quite some refactoring. > > Regards > Werner > > John Huss wrote: > > Thanks for finding that out. I'll see if I can file a bug report. > > > > John > > > > On Wed, Jan 14, 2009 at 3:01 PM, Werner Guttmann < > [email protected]>wrote: > > > >> 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 > >> > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > >

