public void close() throws XMLStreamException { mWriter.close(); }
_xmlWriter.closeCompletely(); } else { _xmlWriter.close();
public void writeEndDocument() throws XMLStreamException { _streamWriter.writeEndDocument(); // And finally, let's indicate stream writer about closure too... _streamWriter.close(); }
_xmlWriter.closeCompletely(); } else { _xmlWriter.close();
public void writeEndDocument() throws XMLStreamException { _streamWriter.writeEndDocument(); // And finally, let's indicate stream writer about closure too... _streamWriter.close(); }
_xmlWriter.closeCompletely(); } else { _xmlWriter.close();
/** * Method for writing out given DOM document using specified * stream writer. *<p> * Note: only regular <code>XMLStreamWriter.close()</code> is * called on the stream writer. This usually means that the underlying * stream is not closed (as per Stax 1.0 specification). */ public void writeDocument(Document doc, XMLStreamWriter sw0) throws XMLStreamException { XMLStreamWriter2 sw = Stax2WriterAdapter.wrapIfNecessary(sw0); sw.writeStartDocument(); for (Node child = doc.getFirstChild(); child != null; child = child.getNextSibling()) { _writeNode(sw, child); } sw.writeEndDocument(); sw.close(); }
xmlWriteStream.close();
/** * Method for writing out given DOM document using specified * stream writer. *<p> * Note: only regular <code>XMLStreamWriter.close()</code> is * called on the stream writer. This usually means that the underlying * stream is not closed (as per Stax 1.0 specification). */ public void writeDocument(Document doc, XMLStreamWriter sw0) throws XMLStreamException { XMLStreamWriter2 sw = Stax2WriterAdapter.wrapIfNecessary(sw0); sw.writeStartDocument(); for (Node child = doc.getFirstChild(); child != null; child = child.getNextSibling()) { _writeNode(sw, child); } sw.writeEndDocument(); sw.close(); }
/** * * @param xmlNode * @return * @throws XMLStreamException */ public static String toXML(XMLNode xmlNode) throws XMLStreamException { String xml = ""; StringWriter stream = new StringWriter(); // Explicitly creating WstxOutputFactory as it is needed by staxmate and it is then easier for // OSGi to find the needed dependencies WstxOutputFactory outputFactory = new WstxOutputFactory(); SMOutputFactory smFactory = new SMOutputFactory(outputFactory); XMLStreamWriter2 writer = smFactory.createStax2Writer(stream); // writer.writeCharacters("\n"); XMLNodeWriter xmlNodewriter = new XMLNodeWriter(writer, 0, 2, ' '); xmlNodewriter.write(xmlNode); writer.close(); xml = stream.toString(); return xml; }
xmlw.close(); } catch (FileNotFoundException fnfe) { System.err.println("Error in " + file.getName() + " " + fnfe.getMessage());
writer.close(); } catch (XMLStreamException e) {
writer.close(); } catch (XMLStreamException e) {
/** * Writes the {@link Annotation} of an {@link SBase} element to an XML {@link String}. * * @param sbase the {@link SBase} element. * @return the {@link Annotation} of the given {@link SBase} element as an XML {@link String}. * @throws XMLStreamException if any error occur while creating the XML document. */ public String writeAnnotation(SBase sbase) throws XMLStreamException { String annotationStr = ""; if ((sbase == null) || !sbase.isSetAnnotation()) { return annotationStr; } StringWriter stream = new StringWriter(); WstxOutputFactory outputFactory = new WstxOutputFactory(); SMOutputFactory smFactory = new SMOutputFactory(outputFactory); XMLStreamWriter2 writer = smFactory.createStax2Writer(stream); // Create an xml fragment to avoid having the xml declaration SMRootFragment outputDocument = SMOutputFactory.createOutputFragment(writer); // all the sbml element namespaces are registered to the writer in the writeAnnotation method // call the writeAnnotation, indicating that we are building an xml fragment writeAnnotation(sbase, outputDocument, writer, 0, true); writer.writeEndDocument(); writer.close(); annotationStr = stream.toString(); return annotationStr; }
@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); } }
xmlWriteStream.close();
xmlWriteStream.close();
xmlWriteStream.close(); flushOutput(); fireEventOccurred(new GeneralOutputEvent("Finished OXL Export.",
@Override public void start() throws Exception { // configure XML factory WstxOutputFactory xmlw = getXMLFactory(); // configure XML writer XMLStreamWriter2 xmlWriteStream = getXMLStreamWriter2(xmlw); fireEventOccurred(new GeneralOutputEvent("Ready to Export.", "[Export - start]")); // start document xmlWriteStream.writeStartDocument(); // write document root element xmlWriteStream.writeStartElement(ROOT); // a graph over-seeds list of concepts / relations if (graph != null) { concepts = graph.getConcepts(); relations = graph.getRelations(); writeGraphInfo(xmlWriteStream); writeMetaDataInfo(xmlWriteStream); writeEachDataSourceMetaData(xmlWriteStream); writeConceptAccessions(xmlWriteStream); } // close XML document properly xmlWriteStream.writeEndElement(); xmlWriteStream.writeEndDocument(); xmlWriteStream.flush(); xmlWriteStream.close(); flushOutput(); fireEventOccurred(new GeneralOutputEvent("Finished Graph Info Export.", "[Export - start]")); }