I want define schema in each xml file that I marshalling. And then get this schema (path string) at unmarshalling process. marshaller.setSchema()
only
开发者_Python百科allows the caller to validate the marshalled XML as it's marshalled.
Yes, I can write extra bean for this purpose, but I want get xml like
<root
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='bla-bla.xsd'>...
To specify a noNamespaceSchemaLocation you can do the following:
JAXBContext jc = JAXBContext.newInstance(Root.class);
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, "bla-bla.xsd");
精彩评论