users@jaxb.java.net

Re: How to customize undefined schema-types?

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Tue, 06 Dec 2005 10:12:48 -0800

Something like what you did should work. Can you file an issue in the
issue tracker with a test case?

Erik Ghint wrote:
> Hi there,
>
> I try to compile/generate JAXB-Classes from a xml-schema with the XJC-compiler.
> Some of the elements within this schema have no defined type.
> Therefore XJC create a class-property of type "AnyType".
> Although I am able to select this specific node in the binding-file I
> am not able to change the java-type for those undefined elements.
>
> Is there a solution or even a good work-around?
>
> This examples may illustrate the problem:
>
> exmpl.xsd:
> [...]
> <complexType name=erson">
> <sequence>
> <element name=irstname" type="xsd:string" />
> <element name=astname" />
> </sequence>
> </complexType>
> [...]
>
> exmpl.xjb:
> [...]
> <jaxb:bindings node=/xs:complexType[@name='person']">
> <jaxb:bindings node=//xs:element[@name='lastname']">
> <jaxb:property name=urname">
> <jaxb:baseType>
> <jaxb:javaType name=ava.lang.String" parseMethod="..."
> printMethod=.."/>
> </jaxb:baseType>
> </jaxb:property>
> </jaxb:bindings>
>
> The result:
> Person.java
> public interface Person extends ...{
> public void setFirstname(String firstname);
> public String getFirstname();
> //and now this :-(
> public void setSurname(AnyType surname);
> public AnyType getSurname(); //The property is not a String but AnyType ...
> }
>
> Sincerly,
> EG
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
> .
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com