On Monday 18 October 2010 7:57:50 am Guillaume Sauthier wrote: > OK, I need a little help on this. > > I'm trying to imlpement the new HTTPClientPolicy "NonProxyHosts" > attributes. Ideally, I would like to directly have in the bean a Pattern > so that it's only initiallized once at parsing time. > > How to deal with that in JAXB ? > It's simple to add a String attribute in the schema resulting in a new > property in the generated bean, but how can I convert it into a regular > Pattern ? > > Some ideas ?
You'll probably need a jaxb binding file for the http-conf.xsd. Not a huge deal. It would need to do two thing: 1) For this element, it would need to set the java class to Pattern (or whatever) 2) Provide parse and print methods. (which would have to be added to a utility class in HTTP component someplace. Here is an example for a Calendar thing: <jxb:bindings schemaLocation="hello_schema2.xsd" node="/xs:schema"> <jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/> </jxb:globalBindings> </jxb:bindings> However, that sets it on a global level which isn't what you'd want. You would need to xpath it into the right element and set it that way. -- Daniel Kulp dk...@apache.org http://dankulp.com/blog