users@jaxb.java.net

Re: Binding an Attributes JavaType via External Customization

From: Malachi de Ælfweald <malachid_at_gmail.com>
Date: Mon, 17 Apr 2006 17:53:47 -0700

Personally, even if you do a workaround, I think I would pursue filing a bug
with the owner of the schema. Decimal values don't have 2 decimal points. I
would suggest to them how they might better do it, so that they might
consider actually fixing it. I am assuming they want a specific format, and
not just any old string, so you might give them a regex xsd snippet....

Just my 2 cents.

Malachi


On 4/12/06, Andrew Hughes <azza_at_lisasoft.com> 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
>
>