On Jan 15, 2008, at 2:45 PM, Werner Guttmann wrote:

Odd. Will be back with an answer. Soonish.

Werner

PS What does your code look like when you call the Unmarshaller ? I hope you are not using one of the static unmarshal methods ... though this surely is not the first time you are trying to use a mapping file, right ?

It's simple, for example purposes, but no, not the static method:

import java.io.FileReader;
import java.util.Iterator;
import java.util.List;

import org.exolab.castor.mapping.Mapping;
import org.exolab.castor.xml.Unmarshaller;

public class BookMapUnmarshaller {

  public static void main(String[] args) {
    Mapping mapping = new Mapping();

    try {
      mapping.loadMapping("book-mapping.xml");
      FileReader reader = new FileReader("book.xml");
      Unmarshaller unmarshaller = new Unmarshaller(mapping);
      Book book = (Book)unmarshaller.unmarshal(Book.class, reader);
      System.out.println("Book ISBN: " + book.getIsbn());
      System.out.println("Book Title: " + book.getTitle());
    } catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace(System.err);
    }
  }
}


Thanks
---
Brett McLaughlin
Series Editor, Head First
O'Reilly Media, Inc.

Phone: (972) 722-6252
Fax:      (972) 692-7958
E-Mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to