Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement