users@jaxb.java.net

Re: Issues with arbitrary transformation of boolean to String

From: Ioannis Mavroukakis <imavroukakis_at_gameaccount.com>
Date: Wed, 23 Sep 2009 17:27:49 +0100

No the XML will be a String 0 or 1, but what I want to transform it
to, is String S or N respectively :-)

Thanks!

Yiannis

On 23 Sep 2009, at 17:15, Wolfgang Laun wrote:

> If the XML is a single letter, then parse must convert from string
> to boolean, print vice versa. And the javaType name is
> java.lang.Boolean.
>
> -W
>
>
> On Wed, Sep 23, 2009 at 4:51 PM, Ioannis Mavroukakis <imavroukakis_at_gameaccount.com
> > wrote:
> Hello fellow listers,
>
> I've got the following conundrum I'd like some help with.
>
> Assume this schema (shortened for brevity)
>
> <xs:element name="Foo">
> <xs:complexType>
> <xs:complexContent>
> <xs:attribute name="bar" type="xs:string"/>
> </xs:complexContent>
> </xs:complexType>
> </xs:element>
>
> In reality, bar is a boolean attribute (stay with me) which I need
> for business reasons to convert to a single character lexical
> equivalent of true/false in another language, for transport over a
> WSDL call.
>
> I thought that I could perhaps use a custom binding to do my biding
> and extend that for different use cases hence
>
> <bindings node="/xsd:schema/xsd:element[@name='Foo']/xsd:complexType/
> xsd:complexContent/xsd:attribute[@name='bar']">
> <property>
> <baseType>
> <javaType name="java.lang.String"
>
> parseMethod="com.transform.PartnerTransform.parseBooleanToString"
>
> printMethod="com.transform.PartnerTransform.printStringToBoolean" />
> </baseType>
> </property>
> </bindings>
>
> However I quickly realised that my cunning plan to assign another
> XMLAdapter while initialising the marshaller for each use case was
> blown out of the water
> as the adapter is randomly named by xjc, and touching the generated
> classes is a no-no.
>
> Therefore, the grand question here is , is there some arcane way to
> make jaxb do that, or should I be looking at a different solution?
>
> Thanks!
>
> Yiannis
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________