Hi,

On 28.05.2012 03:22, J p wrote:
Thanks for your response,

so castor doesn't support pojo xml validation on mashal and unmarshal?

following is my code,

       Book book = new Book();
       book.setAuthor("Jhon");
      //so on....

         Writer writer = new FileWriter("Book.xml");
         Mapping mapping = new Mapping();
         mapping.loadMapping("E:/castor/mapping.xml");

         XMLContext context = new XMLContext();
         // create a new Marshaller
         Marshaller marshaller = context.createMarshaller();
         marshaller.setMapping(mapping);
         marshaller.setWriter(writer);
         marshaller.setNamespaceMapping("","http://www.jhon.com/test";);
         marshaller.setSuppressNamespaces(true);
         //marshaller.setRootElement("Books");
         //marshaller.setValidation(true);
         marshaller.setSchemaLocation("E:\\castor\\book");
         marshaller.marshal(book);
         System.out.println("Completes...ObjectToXML");

the above code would generate an xml called book.xml. i need to validate
this with xsd once the xml being generated. Is there any properties do i
need to set to achieve this?
No, this feature doesn't exist. But Castor always supported validation upon marshalling from the generated descriptor/validator code from an XML schema. Is that not an option for you ?

I always find it an extreme overhead to have an XML schema in place, and still map Java POJOs maunally ... when everything is in place already through Castor's source generation.

Kind Regards
Werner

The mapping file has pojo(Book) to xml(book.xml) bind-xml is defined in
the mapping file.

Thanks


On Mon, May 28, 2012 at 6:32 AM, Matthew Pontius
<[email protected] <mailto:[email protected]>>
wrote:

    Well, what is the context around this? If you are in the soap
    service world Spring can handle this very nicely.

    On May 27, 2012 8:54 PM, "J p" <[email protected]
    <mailto:[email protected]>> wrote:



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

   http://xircles.codehaus.org/manage_email


Reply via email to