users@jaxb.java.net

Re: Binding an Attributes JavaType via External Customization

From: Andrew Hughes <azza_at_lisasoft.com>
Date: Tue, 18 Apr 2006 12:20:25 +0930

Thanks for both of your replies!!

It's now working, and yes I agree I should submit a bug about the xsd.


Cheers!

AH


Andrew Hughes wrote:

> Hey List,
>
> Im trying to implement an Open Standard WebService. This means that I
> can't modify the xsd's to solve the problem, and also cant do the
> customization inline.
>
> My problem is that my incoming document contains a "legal" attribute
> value:
> version="1.1.0"
>
> However JAXB is binding the attibute to the type BigDecimal... and this
> will only work with values "1.0","1.1", eta... not "1.1.1" or "1.1.0". I
> know this is really a fault of the xsd, but i cant change the xsd.
>
> A snippet of the xsd looks like...
>
> ------------------------------------------------------------------------------------
>
> <complexType name="BASEType">
> <attribute name="version" type="decimal" use="required"/>
> <!-- other suff I dont care about removed -->
> </complexType>
> ------------------------------------------------------------------------------------
>
>
>
> My External Customization Currently is this, but its still using
> BigDecimal :(
> ------------------------------------------------------------------------------------
>
> <jxb:bindings version="1.0"
> xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <jxb:bindings schemaLocation="BASE.xsd" node="/xs:schema">
> <!-- version was decimal but doesnt work with x.x.x only x.x -->
> <jxb:bindings
> node="//xs:complexType[@name='BASEType']//xs:attribute[@name='version']">
> <!-- START OF STUFF NOT WORKING FOR ME -->
> <jxb:property name="version">
> <jxb:baseType name="java.lang.String">
> <jxb:javaType name="java.lang.String"
> parseMethod="new" printMethod="toString" />
> </jxb:baseType>
> </jxb:property>
> <!-- END OF STUFF NOT WORKING FOR ME -->
> </jxb:bindings>
> </jxb:bindings>
> </jxb:bindings>
> ------------------------------------------------------------------------------------
>
>
> It looks like I am using the wrong operation (<jxb:property>) to achieve
> this... can someone help me out with an xjb solution please.
>
>
> Thanks in Advance
>
> Az
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>