/** * Method for constructing Stax stream writer to write xml content * to specified file. * Underlying stream writer will be constructed using Stax factory * this StaxMate factory was constructed with. *<p> * Encoding used will be UTF-8. */ public XMLStreamWriter2 createStax2Writer(File f) throws XMLStreamException { if (_stax2Factory != null) { /* have real stax2 factory; can create more optimal writer * (most importantly: one that automatically closes the writer) */ Stax2FileResult res = new Stax2FileResult(f); return (XMLStreamWriter2) _stax2Factory.createXMLStreamWriter(res); } /* No, just stax1 factory. Could use StreamResult; but some * impls might not recognize it... immediate problem here: * auto-closing won't work. */ try { FileOutputStream out = new FileOutputStream(f); return Stax2WriterAdapter.wrapIfNecessary(_staxFactory.createXMLStreamWriter(out)); } catch (FileNotFoundException fex) { throw new XMLStreamException(fex); } }
/** * Method for constructing Stax stream writer to write xml content * to specified file. * Underlying stream writer will be constructed using Stax factory * this StaxMate factory was constructed with. *<p> * Encoding used will be UTF-8. */ public XMLStreamWriter2 createStax2Writer(File f) throws XMLStreamException { if (_stax2Factory != null) { /* have real stax2 factory; can create more optimal writer * (most importantly: one that automatically closes the writer) */ Stax2FileResult res = new Stax2FileResult(f); return (XMLStreamWriter2) _stax2Factory.createXMLStreamWriter(res); } /* No, just stax1 factory. Could use StreamResult; but some * impls might not recognize it... immediate problem here: * auto-closing won't work. */ try { FileOutputStream out = new FileOutputStream(f); return Stax2WriterAdapter.wrapIfNecessary(_staxFactory.createXMLStreamWriter(out)); } catch (FileNotFoundException fex) { throw new XMLStreamException(fex); } }
public Observable<JsonNode> generate(final Observable<JsonNode> recordGDM, final OutputStream outputStream) throws XMLStreamException { LOG.debug("start generating Solr Update XML out of GDM"); final XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(outputStream); writer.writeStartDocument(StandardCharsets.UTF_8.toString(), XML_VERSION); // process records to XML final SolrUpdateXMLRelationshipHandler relationshipHandler = new CBDRelationshipHandler(writer); final CBDNodeHandler connectRelsAndNodeHandler = new CBDNodeHandler(relationshipHandler); final SolrUpdateXMLNodeHandler startNodeHandler = new CBDStartNodeHandler(connectRelsAndNodeHandler, writer); final XMLExportOperator operator = new XMLExportOperator(writer, startNodeHandler); return recordGDM.lift(operator); }
XMLStreamWriter2 xmlWriteStream = (XMLStreamWriter2) xmlOutput.createXMLStreamWriter(outStream, CharsetNames.CS_UTF8); buildDocument(xmlWriteStream, graph);
public Observable<JsonNode> generate(final Observable<JsonNode> recordGDM, final OutputStream outputStream) throws XMLStreamException { LOG.debug("start generating XML out of GDM"); final XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(outputStream); writer.writeStartDocument(StandardCharsets.UTF_8.toString(), XML_VERSION); // process records to XML final XMLRelationshipHandler relationshipHandler; if (originalDataTypeIsXML) { relationshipHandler = new CBDRelationshipXMLDataModelHandler(writer); } else { relationshipHandler = new CBDRelationshipHandler(writer); } final CBDNodeHandler connectRelsAndNodeHandler = new CBDNodeHandler(relationshipHandler); final XMLNodeHandler startNodeHandler = new CBDStartNodeHandler(connectRelsAndNodeHandler, writer); final XMLExportOperator operator = new XMLExportOperator(writer, startNodeHandler); return recordGDM.lift(operator); }
reader = (XMLStreamReader2) inputFactory.createXMLStreamReader(new CharArrayReader(chars, offset, length)); writer = (XMLStreamWriter2) outputFactory.createXMLStreamWriter(new StringBuilderWriter(output));
final XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(outputStream);
try { XMLStreamWriter2 xmlw = (XMLStreamWriter2) xmlOutput.createXMLStreamWriter(new FileWriter(file), CharsetNames.CS_UTF8);
writer = (XMLStreamWriter2) outputFactory.createXMLStreamWriter(stringBuilderWriter);
@Override public void start(File file) { // xml output XMLOutputFactory2 xmlOutput = (XMLOutputFactory2) XMLOutputFactory2 .newInstance(); xmlOutput.configureForSpeed(); xmlOutput.setProperty(XMLOutputFactory2.IS_REPAIRING_NAMESPACES, false); try { // output file writer OutputStream outStream = new FileOutputStream(file); if (outStream != null) { XMLStreamWriter2 xmlWriteStream = (XMLStreamWriter2) xmlOutput .createXMLStreamWriter(outStream, "ISO-8859-1"); writeDocument(viewer.getGraphLayout().getGraph(), xmlWriteStream); xmlWriteStream.flush(); xmlWriteStream.close(); outStream.flush(); outStream.close(); } } catch (Exception e) { ErrorDialog.show(e); } }
try { XMLStreamWriter2 xmlWriteStream = (XMLStreamWriter2) xmlOutput.createXMLStreamWriter(outStream, CharsetNames.CS_UTF8);
XMLStreamWriter2 writer = (XMLStreamWriter2) output.createXMLStreamWriter(os);
try { XMLStreamWriter2 xmlWriteStream = (XMLStreamWriter2) xmlOutput.createXMLStreamWriter(outStream, CharsetNames.CS_UTF8);
try { XMLStreamWriter2 xmlWriteStream = (XMLStreamWriter2) xmlOutput.createXMLStreamWriter(outStream, CharsetNames.CS_UTF8);
writer = (XMLStreamWriter2) output.createXMLStreamWriter(outputStream);