commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edmond Wong <wyw...@pacbell.net>
Subject Re: BetWixt's bug where it cannot generate XML if the root class only contain a class parameter?
Date Wed, 27 Apr 2005 01:51:42 GMT
Thanks for the fix and Sorry for the misspelled prefix.  Edmond

robert burrell donkin wrote:

>sorry it's taken a while: my filters missed the misspelled prefix.
>
>yes, this is a bug (in the ignore empty element code). i've just
>committed. if you roll from HEAD or wait till the next nightly, i hope
>this your problem will be fixed.
>
>- robert
>
>On Fri, 2005-04-22 at 22:21 -0700, Edmond Wong wrote:
>  
>
>>Hi,
>>
>>I am using the nightly build of the bewixt library, and got the follow 
>>problem on the output where the xml document is not generated.  The 
>>problem happen when I have a root class PersonBean where it only 
>>contains a Book class for its parameter:
>>
>>import java.io.StringWriter;
>>import org.apache.commons.betwixt.io.BeanWriter;
>>
>>Public class WriteExampleApp {
>>    public static void main(String[] args) throws Exception {            
>>   
>>        PersonBean pb = new PersonBean();
>>        pb.setBook(new Book("Edmond Book", "Edmond"));   
>>        System.out.println(pb);       
>>        StringWriter outputWriter = new StringWriter();       
>>        outputWriter.write("<?xml version='1.0' ?>\n");             
>>        BeanWriter beanWriter = new BeanWriter(outputWriter);
>>        beanWriter.enablePrettyPrint();
>>        beanWriter.getBindingConfiguration().setMapIDs(true);      
>>        
>>beanWriter.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
>>        beanWriter.setWriteEmptyElements(false);
>>        beanWriter.write(pb);       
>>        System.out.println(outputWriter.toString());       
>>    }
>>}
>>
>>The output:
>>PersonBean@f6a746[book=Book@13e8d89[name_of_book=Edmond Book,author=Edmond]]
>><?xml version='1.0' ?>
>>
>>PersonBean.class:
>>
>>import org.apache.commons.lang.builder.ToStringBuilder;
>>
>>public class PersonBean implements java.io.Serializable {
>>    private Book book = new Book();
>>    public PersonBean() {
>>    }
>>    public PersonBean(Book book) {
>>        super();
>>        this.book = book;
>>    }
>>    public Book getBook() {
>>        return this.book;
>>    }
>>    public void setBook(Book book) {
>>        this.book = book;
>>    }
>>    public String toString() {
>>        return ToStringBuilder.reflectionToString(this);
>>    }
>>}
>>
>>Book.class:
>>
>>import org.apache.commons.lang.builder.ToStringBuilder;
>>
>>public class Book implements java.io.Serializable {
>>    String name_of_book;
>>    String author;
>>    public Book() {
>>    }
>>    public Book(String name_of_book, String author) {
>>        super();
>>        this.name_of_book = name_of_book;
>>        this.author = author;
>>    }
>>    public String getAuthor() {
>>        return author;
>>    }
>>    public void setAuthor(String author) {
>>        this.author = author;
>>    }
>>    public String getName_of_book() {
>>        return name_of_book;
>>    }
>>    public void setName_of_book(String name_of_book) {
>>        this.name_of_book = name_of_book;
>>    }
>>    public String toString() {
>>        return ToStringBuilder.reflectionToString(this);
>>    }
>>}
>>
>>Thanks,
>>
>>Edmond
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message