Search in sources :

Example 6 with Dictionary

use of biblemulticonverter.schema.zefdic1.Dictionary in project BibleMultiConverter by schierlm.

the class ZefDicMyBible method doExport.

@Override
public void doExport(Bible bible, String... exportArgs) throws Exception {
    File file = new File(exportArgs[0]);
    String[] idfields = (exportArgs.length > 1 ? exportArgs[1] : "long,short").split(",");
    Dictionary xmlbible = createXMLBible(bible, idfields);
    final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class);
    Marshaller m = ctx.createMarshaller();
    m.marshal(xmlbible, doc);
    doc.normalize();
    maskWhitespaceNodes(doc.getDocumentElement());
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    transformer.transform(new DOMSource(doc), new StreamResult(file));
}
Also used : Dictionary(biblemulticonverter.schema.zefdic1.Dictionary) Marshaller(javax.xml.bind.Marshaller) DOMSource(javax.xml.transform.dom.DOMSource) Transformer(javax.xml.transform.Transformer) StreamResult(javax.xml.transform.stream.StreamResult) JAXBContext(javax.xml.bind.JAXBContext) Document(org.w3c.dom.Document) File(java.io.File)

Aggregations

Dictionary (biblemulticonverter.schema.zefdic1.Dictionary)5 Book (biblemulticonverter.data.Book)3 SeeType (biblemulticonverter.schema.zefdic1.SeeType)3 TItem (biblemulticonverter.schema.zefdic1.TItem)3 TParagraph (biblemulticonverter.schema.zefdic1.TParagraph)3 JAXBContext (javax.xml.bind.JAXBContext)3 BookID (biblemulticonverter.data.BookID)2 FormattedText (biblemulticonverter.data.FormattedText)2 Visitor (biblemulticonverter.data.FormattedText.Visitor)2 MetadataBook (biblemulticonverter.data.MetadataBook)2 BibLinkType (biblemulticonverter.schema.zefdic1.BibLinkType)2 MyAnyType (biblemulticonverter.schema.zefdic1.MyAnyType)2 ObjectFactory (biblemulticonverter.schema.zefdic1.ObjectFactory)2 RefLinkType (biblemulticonverter.schema.zefdic1.RefLinkType)2 File (java.io.File)2 JAXBElement (javax.xml.bind.JAXBElement)2 Marshaller (javax.xml.bind.Marshaller)2 Transformer (javax.xml.transform.Transformer)2 DOMSource (javax.xml.transform.dom.DOMSource)2 StreamResult (javax.xml.transform.stream.StreamResult)2