How to marshal XML documents with version 1.1 Intended Audience Context Configuration
Intended Audience
Anyone who wants to use Castor XML for XML data binding, namely marshalling
operations, and produce XML document instances that carry a the version
1.1 in the XML preamble.
Context
Before release 1.3.2, Castor was able to produce XML documents upon
marshalling that had the following XML preamble (if not omitted on
purpose) only:
<?xml version="1.0" encoding="UTF-8"?>
<foo/> |
|
With the release of the XML document standard version 1.1, it was necessary
to add an option to have the following preamble generated:
<?xml version="1.1" encoding="UTF-8"?>
<foo/> |
|
Configuration
To make Castor output version 1.1 in the XML preamble as produced
upon marshalling an object instance to XML, the org.exolab.castor.xml.version
property has to be overriden in a custom, user-specific
castor.properties> file.
org.exolab.castor.xml.version=1.1 |
|
Alternatively, you can set the property directly on the XMLContext
instance using ...
XMLContext.setProperty(XMLProperties.XML_VERSION, "1.1"); |
|
before creating Marshaller instances from the XMLContext instance
using XMLContext.createMarshaller().
|