Katz Guy wrote:
>
> Hi;
>
> Reading the jaxb user guide I couldn?t understand if I can acheve the
> following. I would appreciate any help.
>
> basically , In my project i have huge huge xml schemas and would like to
> generate a small class(or a number of small classes) per schema which
> represent a fragment of that schema.
>
> For example; We would like the schema:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
> <xs:element name="a">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="b" type="xs:string"/>
> <xs:element name="c" type="xs:string"/>
> <xs:element name="d" type="xs:string"/>
> <xs:element name="e">
> <xs:complexType>
> <xs:sequence>
> <xs:element
> name="f" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
>
> To be generated into:
> Interface <someIfc>{
> public string getB();
> public void setB(String b);
> }
> and
> Class <someName> implements <someIfc>{
> String b;
> public string getB(){return b;}
> public void setB(String b){this.b=b;}
> }
>
> Discurding most of the schema content in the generated classes. Yet when
> transforming an instance of that class into XML we would like it to
> transfrom according to the full scema.
>
> For example:
> An instance of class <someName> with string value of b set to "b" will
> be transformed into:
> <a>
> <b>b</b>
> <c/>
> <d/>
> <e>
> <f/>
> </e>
> </a>
>
> Or something like that.
>
> I figured this would be done by custom bindings but could not find the
> way to do this in the user guide.(maybe I didn?t understand the guide
> very well)
>
Guy,
The binding customizations allow you change the default bindings generated
by the compiler, but there is no way to limit the generated interfaces to
specific fragments of the schema as you described. There may be some
extremely limited use cases where you might be able to force JAXB to behave
this way, but in general this is not possible. I'll think about it some more,
but in the mean-time, I'd be interested to know if anyone else on the list
has any thoughts...
--Ryan
> Is JAXB an apprepriate technology for this? I could not get this from
> the manual.
> I would really appreciate any respose
> Thanks.
>
>
>
> _______________________
> Guy Katz
> Comverse
> guy.katz_at_comverse.com
> +972 3 7663686
>
>