You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by 梁昌宏 <li...@163.com> on 2013/06/28 03:03:09 UTC

JavaBean xml conversion problems

Dear all:

    I found betwixt very interesting study for a day yesterday, but I encountered a problem can not be solved, I hope you can give me suggestions,Questions are as follows;

JavaBean

public class Test {
 private String carNo;

 public Test(String carNo) {
  super();
  this.carNo = carNo;
 }

 public String getCarNo() {
  return carNo;
 }

 public void setCarNo(String carNo) {
  this.carNo = carNo;
 }

 public Test() {
  super();
 }
}

Test.betwixt template

<info primitiveTypes="element">
 <element name='Test'>
  <element property='carNo'></element>
  </element>
</info>

If carNo is null, I want to generate the xml-stylesheet is
<carNo xsi:nil="true"></carNo>

Instead of
<carNo></carNo>

How to achieve the effect I want, please advice

梁昌宏 
深圳机场物流园发展有限公司 信息部 
手机:13430573145
地址:深圳宝安机场保税大厦413室 邮编:518128 

Re: JavaBean xml conversion problems

Posted by Maurizio Cucchiara <mc...@apache.org>.
Unfortunately I'm not a Betwixt guru, but this page [1] contains probably
what you are looking for.

PS: In order to get more visibility on the list, next time, considering to
respect the Commons conventions and add the [betwixt] prefix on your
subject.


[1] http://commons.apache.org/proper/commons-betwixt/guide/binding.html<http://commons.apache.org/proper/commons-betwixt/guide/binding.html>



Twitter     :http://www.twitter.com/m_cucchiara
G+          :https://plus.google.com/107903711540963855921
Linkedin    :http://www.linkedin.com/in/mauriziocucchiara
VisualizeMe: http://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara

Maurizio Cucchiara


On 28 June 2013 03:03, 梁昌宏 <li...@163.com> wrote:

> Dear all:
>
>     I found betwixt very interesting study for a day yesterday, but I
> encountered a problem can not be solved, I hope you can give me
> suggestions,Questions are as follows;
>
> JavaBean
>
> public class Test {
>  private String carNo;
>
>  public Test(String carNo) {
>   super();
>   this.carNo = carNo;
>  }
>
>  public String getCarNo() {
>   return carNo;
>  }
>
>  public void setCarNo(String carNo) {
>   this.carNo = carNo;
>  }
>
>  public Test() {
>   super();
>  }
> }
>
> Test.betwixt template
>
> <info primitiveTypes="element">
>  <element name='Test'>
>   <element property='carNo'></element>
>   </element>
> </info>
>
> If carNo is null, I want to generate the xml-stylesheet is
> <carNo xsi:nil="true"></carNo>
>
> Instead of
> <carNo></carNo>
>
> How to achieve the effect I want, please advice
>
> 梁昌宏
> 深圳机场物流园发展有限公司 信息部
> 手机:13430573145
> 地址:深圳宝安机场保税大厦413室 邮编:518128
>