Reputation: 15792
I want define schema in each xml file that I marshalling. And then get this schema (path string) at unmarshalling process. marshaller.setSchema()
only
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'>...
Upvotes: 4
Views: 10716
Reputation: 149047
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");
Upvotes: 6