Hi Nestor, >From my personal experience yesterday using JAXB, you can only assign a single namespace at the root element level with the XmlRootElement annotation in a class. This is inline with the XML Schema standard as you can only have a single namespace per schema. You therefore can annotate your POJO's with different XmlRootElement annotations and hopefully when marshalling get an output that defines all the namespaces and places prefixes on the elements accordingly.
Chris What should happen (haven't tried it yet), is 2012/3/9 Néstor Boscán <[email protected]> > Thanks Glen > > Yes I'm trying to assign package names to individual classes and from what > I searched with google it looks like I can only map to a schema level. > > Regards, > > Néstor Boscán > > On Fri, Mar 9, 2012 at 9:01 AM, Glen Mazza <[email protected]> wrote: > > > I'm not sure. I thought you can assign package names only to the schema > > as a whole and not individual elements within the schema, but may have > been > > wrong. Further, I'm unsure if JAXB assigns packages to complexTypes or > > just to the classes that implement that type--I'm not exactly sure what > > you're trying to do. > > > > Hopefully someone else can help, there's also a JAXB user's list (CXF > > hands this processing off to the JAXB reference implementation and so > > that's the error message you're seeing below.) You can also google > > "compiler was unable to honor this schemaBinding customization", right > now > > it's returning 52 hits, one of which might provide your answer. > > > > Glen > > > > > > On 03/09/2012 07:47 AM, Néstor Boscán wrote: > > > >> Hi Glenn > >> > >> Thanks for the quick reply. I tried with the schemaBindings and I get: > >> > >> [INFO] Thrown by JAXB: compiler was unable to honor this schemaBinding > >> customization. It is attached to a wrong place, or its inconsistent with > >> other bindings. > >> > >> If the node attribute in the bindings element points to the schema > element > >> no problem, but if it points to a complexType I get this error. > >> > >> Regards, > >> > >> Néstor Boscán > >> > >> On Fri, Mar 9, 2012 at 4:44 AM, Glen Mazza<[email protected]> wrote: > >> > >> Unsure if this is the issue but when I had done this in the past ( > >>> http://www.jroller.com/****gmazza/entry/customizing_jaxb_****< > http://www.jroller.com/**gmazza/entry/customizing_jaxb_**> > >>> artifacts#BindingFile<http://**www.jroller.com/gmazza/entry/** > >>> customizing_jaxb_artifacts#**BindingFile< > http://www.jroller.com/gmazza/entry/customizing_jaxb_artifacts#BindingFile > > > >>> >) > >>> > >>> the parent of<jxb:package/> was<jaxb:schemaBindings/>, not > >>> <jaxws:bindings/> > >>> > >>> HTH, > >>> Glen > >>> > >>> > >>> On 03/09/2012 03:53 AM, Néstor Boscán wrote: > >>> > >>> Hi > >>>> > >>>> I have the following binding file: > >>>> > >>>> <jaxws:bindings > >>>> xmlns:jaxws="http://java.sun.****com/xml/ns/jaxws< > >>>> http://java.**sun.com/xml/ns/jaxws <http://java.sun.com/xml/ns/jaxws > >> > >>>> " > >>>> xmlns:xs="http://www.w3.org/****2001/XMLSchema< > http://www.w3.org/**2001/XMLSchema> > >>>> <http://www.w3.**org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema > >> > >>>> " > >>>> xmlns:jxb="http://java.sun.****com/xml/ns/jaxb<http://java. > ** > >>>> sun.com/xml/ns/jaxb <http://java.sun.com/xml/ns/jaxb>> > >>>> " > >>>> xmlns:wsdl="http://schemas.**x**mlsoap.org/wsdl/< > http://xmlsoap.org/wsdl/> > >>>> <http://**schemas.xmlsoap.org/wsdl/ <http://schemas.xmlsoap.org/wsdl/ > >> > >>>> "> > >>>> <jaxws:bindings > >>>> node="wsdl:definitions/wsdl:****types/xs:schema/xs:** > >>>> > >>>> complexType[@name='MyFault1' > >>>> or @name=' MyFault2' or @name=' MyFault3' ]"> > >>>> <jxb:package name="myexceptionpackage"/> > >>>> </jaxws:bindings> > >>>> <jaxws:bindings > >>>> node="wsdl:definitions/wsdl:****types/xs:schema/xs:** > >>>> > >>>> complexType[@name='myTo1']"> > >>>> <jxb:package name="mypackage1"/> > >>>> </jaxws:bindings> > >>>> <jaxws:bindings > >>>> node="wsdl:definitions/wsdl:****types/xs:schema/xs:** > >>>> > >>>> complexType[@name='myTo2']"> > >>>> <jxb:package name="mypackage2"/> > >>>> </jaxws:bindings> > >>>> </jaxws:bindings> > >>>> > >>>> The wsdl2java executes correctly but non of my classes are defined in > >>>> the > >>>> packages that I configured. > >>>> > >>>> Regards, > >>>> > >>>> Néstor Boscán > >>>> > >>>> > >>>> -- > >>> Glen Mazza > >>> Talend Community Coders - coders.talend.com > >>> blog: www.jroller.com/gmazza > >>> > >>> > >>> > > > > -- > > Glen Mazza > > Talend Community Coders - coders.talend.com > > blog: www.jroller.com/gmazza > > > > > -- Chris Riley, Partner HKM Consulting LLC (o) 774.553.5314 (m) 508.273.3102 (f) 774.553.5316
