Hi Mattias, Mattias Jiderhamn wrote: > I'm sorry if this is clearly documented somewhere but I'm just too > stressed out to see it. > > I am using the XML source generator with a mapping binding file using > defaultBindingType="type". > My schema declares the root element as > <xsd:element name="foo" type="fooType"/> > When marshalling an instance of the generated FooType class with > Marshaller.marshal(), the name of the root element is <fooType> while I > need it to be <foo>. Probem is that in 'type' mode, no Java classes are generated for (top-level) element definitions. > > I tried adding an explicit elementBinding to my mapping binding file, to > get a class for the element: > <elementBinding name="/foo"> > <java-class name="bar.baz.Foo" /> > </cbf:elementBinding> > This didn't have any effect at all. I assume the elementBinding cannot > be used in combination with defaultBindingType="type"? Correct. That does not have any effect during code generation, as you are in 'type' mode.
> I cannot use Marshaller.setRootElement() since the example above is a > bit simplified. The FooType instance is actually added as an AnyObject > in an outer schema hierachy which is then Marshalled. > > So what is the best/easiest way to solve this??? > Can I add a new class-descriptor mapping to the Marshaller before > marshaling? I guess you cannot. Would switching to element mode be an option to you ? > > Thanks in advance, > > /Mattias > > --------------------------------------------------------------------- > 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

