castor doesn't support generated xml validation on mashal and unmarshal?
following is my code,
Book book = new Book();
book.setAuthor("jose");
//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.jose.com/test<http://www.jhon.com/test>
");
marshaller.setSuppressNamespaces(true);
//marshaller.setRootElement("Books");
//marshaller.setValidation(true);
marshaller.setSchemaLocation("E:\\castor\\book.xsd");
marshaller.marshal(book);
the above code would generate an xml called book.xml. i need to validate
this with its xsd once the xml is generated. Is there any properties do i
need to set to achieve this?
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 7:24 AM, J p <[email protected]> wrote:
> hi werner,
>
> FYI..
>
> i need your help on this..
>
> Thank
>
>
> ---------- Forwarded message ----------
> From: J p <[email protected]>
> Date: Mon, May 28, 2012 at 6:52 AM
> Subject: Re: [castor-user] XML Validation with its XSD Schema when
> marshalling and unmarshalling
> To: [email protected]
>
>
> 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("jose");
> //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.jose.com/test<http://www.jhon.com/test>
> ");
> marshaller.setSuppressNamespaces(true);
> //marshaller.setRootElement("Books");
> //marshaller.setValidation(true);
> marshaller.setSchemaLocation("E:\\castor\\book.xsd");
> marshaller.marshal(book);
>
>
> 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?
>
> 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]> 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]> wrote:
>>
>
>
>