users@jaxb.java.net

customize print and parse methods

From: Christoph Brunner <news_chbr0001_at_yahoo.de>
Date: Thu, 25 Mar 2004 21:06:44 +0100 (CET)

Hi,

i use JAXB customizing to specifiy my own parse and
print methods for specific values.
For the attribute V of the tag 'Ergebniswert' i want
to suppress zeros.
Example: For the value '2.0' i want to print '2'.

I do this with the attached xjb file and this works
fine.

Now i got new requirements!
Supressing the zero should depend on the value of the
V attribute from the 'Parameter' tag.
Example:
If <Parameter V="Param1"> then <Ergebniswert V="2"/>
If <Parameter V="Param2"> then <Ergebniswert V="2.0"/>

Is this possible with JAXB?

Thank you very much
Christoph Brunner



        
                
Mit schönen Grüßen von Yahoo! Mail - http://mail.yahoo.de

<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="./MySchema.xsd" node="/xs:schema">
                <jxb:bindings node=".//xs:element[@name='Ergebniswert']">
                        <jxb:bindings node="./xs:complexType">
                                <jxb:bindings node=".//xs:attribute[@name='V']">
                                        <jxb:property>
                                          <jxb:baseType>
                                      <jxb:javaType name="float"
                                          parseMethod="jaxb.framework.JAXBDatatypeConverter.parseFloatToFloat"
                                          printMethod="jaxb.framework.JAXBDatatypeConverter.printFloatToString" />
                              </jxb:baseType>
                            </jxb:property>
              </jxb:bindings>
            </jxb:bindings>
                </jxb:bindings>
  </jxb:bindings>
  
  </jxb:bindings>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net