1001 * имеющий *
String translationXsd = TranslationPropertyHelper.getFileLocation(PropertyKey.TRANSLATE_XSD_FILE);
File translationXsdFile = new File(translationXsd);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(translationXsdFile);
JAXBContext jaxbContext = JAXBContext
.newInstance(translationJob.getClass().getPackage().getName());
Marshaller marshaller = jaxbContext.createMarshaller();
OutputStream os = new FileOutputStream(pOutputFile);
XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
XMLStreamWriter xsw = new IndentingXMLStreamWriter(xmlof.createXMLStreamWriter(os));
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.setProperty(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, translationXsdFile.getName());
marshaller.setSchema(schema);
marshaller.marshal(translationJob, xsw);
xsw.close();
со свободным текстом, например, "Привет, у меня есть полужирный текст внутри." в узле
создает
<freetextnode>hello i have < b > bold < / b > text inside.</freetextnode>
ожидание:
<freetextnode>hello i have < b > bold < / b > text inside.</freetextnode>
JavaEE 7.