/** {@inheritDoc} */ @Override public void print(Annotation annotation, OutputStream os, Options options) throws IOException { Document xmlDoc = annotationToDoc(annotation, options); Serializer ser = new Serializer(os, options.encoding); if (options.pretty) { ser.setIndent(2); } else { ser.setIndent(0); } ser.setMaxLength(0); ser.write(xmlDoc); ser.flush(); }
private static void writeFile( final File file, final Document document) throws IOException { JSCMain.LOG.info("writing " + file); final BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); try { final Serializer s = new Serializer(stream); s.write(document); s.flush(); } finally { stream.flush(); stream.close(); } }
public static void format(OutputStream os, Document doc) throws Exception { Serializer serializer = new Serializer(os,"ISO-8859-1"); serializer.setIndent(4); serializer.setMaxLength(60); serializer.write(doc); serializer.flush(); } public static void
final Serializer s = new Serializer(os, "UTF-8"); s.write(doc); s.flush();
public static void xmlPrint(Annotation annotation, OutputStream os, Options options) throws IOException { Document xmlDoc = annotationToDoc(annotation, options); Serializer ser = new Serializer(os, options.encoding); ser.setIndent(2); ser.setMaxLength(0); ser.write(xmlDoc); ser.flush(); }
final Serializer s = new Serializer(os, "UTF-8"); s.write(new Document((Element) xs.serialize(b))); s.flush();
/** * Displays the output of all annotators in XML format. * @param annotation Contains the output of all annotators * @param os The output stream * @throws IOException */ public void xmlPrint(Annotation annotation, OutputStream os) throws IOException { Document xmlDoc = annotationToDoc(annotation); Serializer ser = new Serializer(os, "UTF-8"); ser.setIndent(2); ser.setMaxLength(0); ser.write(xmlDoc); ser.flush(); }
/** {@inheritDoc} */ @Override public void print(Annotation annotation, OutputStream os, Options options) throws IOException { Document xmlDoc = annotationToDoc(annotation, options); Serializer ser = new Serializer(os, options.encoding); if (options.pretty) { ser.setIndent(2); } else { ser.setIndent(0); } ser.setMaxLength(0); ser.write(xmlDoc); ser.flush(); }
/** * Write a collection of specifications to an output stream. * * @param specifications * the specifications * @param out * the output stream */ public void write(Collection<Specification> specifications, OutputStream out) { nu.xom.Element eSpecs = new nu.xom.Element("specifications", NS); for (Specification spec : specifications) { nu.xom.Element eSpec = toElement(spec); eSpecs.appendChild(eSpec); } nu.xom.Document doc = new nu.xom.Document(eSpecs); try { Serializer serializer = new Serializer(out); serializer.setIndent(2); serializer.setMaxLength(2000); serializer.write(doc); serializer.flush(); } catch (IOException ex) { System.out.println(ex + " " + out); } }
final Serializer serial = new Serializer(output, "UTF-8"); serial.write(doc); serial.flush();
/** * Write the specification to an output stream. * * @param specification * the specification * @param out * the output stream */ public void write(Specification specification, OutputStream out) { nu.xom.Element eSpec = toElement(specification); eSpec.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance"); eSpec.addAttribute(new nu.xom.Attribute("xsi:schemaLocation", "http://www.w3.org/2001/XMLSchema-instance", "http://opendse.sourceforge.net http://opendse.sourceforge.net/schema.xsd")); nu.xom.Document doc = new nu.xom.Document(eSpec); try { Serializer serializer = new Serializer(out); serializer.setIndent(2); serializer.setMaxLength(2000); serializer.write(doc); serializer.flush(); } catch (IOException ex) { System.out.println(ex + " " + out); } }