Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. String translationXsd = TranslationPropertyHelper.getFileLocation(PropertyKey.TRANSLATE_XSD_FILE);
  2. File translationXsdFile = new File(translationXsd);
  3.  
  4. SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
  5. Schema schema = schemaFactory.newSchema(translationXsdFile);
  6.  
  7. JAXBContext jaxbContext = JAXBContext
  8. .newInstance(translationJob.getClass().getPackage().getName());
  9. Marshaller marshaller = jaxbContext.createMarshaller();
  10. OutputStream os = new FileOutputStream(pOutputFile);
  11. XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
  12. XMLStreamWriter xsw = new IndentingXMLStreamWriter(xmlof.createXMLStreamWriter(os));
  13. marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
  14. marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
  15. marshaller.setProperty(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, translationXsdFile.getName());
  16. marshaller.setSchema(schema);
  17. marshaller.marshal(translationJob, xsw);
  18. xsw.close();
  19.  
  20. <freetextnode>hello i have < b > bold < / b > text inside.</freetextnode>
  21.  
  22. <freetextnode>hello i have < b > bold < / b > text inside.</freetextnode>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement