I'm trying trying to marshall java objects. Its marshalling as below.
 
 
<?xml version="1.0" encoding="UTF-8"?>
<Library>
<ns1:Publication xsi:type="ns1:BookType" xmlns:ns1="http://www.books.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns1:Title>Illusions The Adventures of a Reluctant Messiah</ns1:Title>
<ns1:Author>Richard Bach</ns1:Author>
<ns1:Date>1977</ns1:Date>
<ns1:ISBN>0-440-34319-4</ns1:ISBN>
<ns1:Publisher>Dell Publishing Co.</ns1:Publisher>
</ns1:Publication>
<ns2:Publication xsi:type="ns1:BookType" xmlns:ns2="http://www.books.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns2:Title>Illusions The Adventures of a Reluctant Messiah</ns2:Title>
<ns2:Author>Richard Bach</ns2:Author>
<ns2:Date>1977</ns2:Date>
<ns2:ISBN>0-440-34319-4</ns2:ISBN>
<ns2:Publisher>Dell Publishing Co.</ns2:Publisher>
</ns2:Publication>
</Library>
 
I've created only one java object of BookType ans marshalled it. When I looked into the xml file its showing two objects.
 
My java code is as follows..
 

Library library=new Library();

BookType book=new BookType();

String [] authors={"Richard Bach"};

book.setAuthor(authors);

book.setDate(new GYear(1977));

book.setISBN("0-440-34319-4");

book.setPublisher("Dell Publishing Co.");

book.setTitle("Illusions The Adventures of a Reluctant Messiah");

library.addPublication(book);

Writer writer = new FileWriter(file);

Marshaller marshaller = new Marshaller(writer);

marshaller.setMapping(map);

marshaller.marshal(library);

Could you let me know if I'm doing anything wrong? How to solve this problem...

 


Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to