@Deprecated public static String indentXML(final String in) throws XMLException, IOException { try { Builder parser = new Builder(); Document doc = parser.build(in, null); ByteArrayOutputStream baos = new ByteArrayOutputStream(); Serializer serializer = new Serializer(baos); serializer.setIndent(4); serializer.setMaxLength(69); serializer.write(doc); return new String(baos.toByteArray()); } catch (ParsingException ex) { // LOG.log(Level.SEVERE, null, ex); throw new XMLException("XML indentation failed.", ex); } } }
/** {@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(); }
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 serializer = new Serializer(z_out, "UTF-8"); serializer.setIndent(2); serializer.setMaxLength(80); serializer.setLineSeparator("\n"); serializer.write(document);
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(); }
/** * 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); } }
/** * 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); } }
public void generateXmlSchema(OutputStream output, boolean excludeOptional) throws Exception { Element configEl = new Element("config", namespaceUri); configEl.addNamespaceDeclaration(null, namespaceUri); for (InjectableProperty property : new ConfigClassAnalyzer(configClass).getConfigProperties()) { if (excludeOptional && property.isOptional()) { continue; } if (property.isContextual()) { continue; } if (property.isArray()) { addArrayProperty(configEl, property); } else if (property.isCollection()) { addCollectionProperty(configEl, property); } else if (property.isMap()) { addMapProperty(configEl, property); } else if (property.isReference()) { addReferenceProperty(configEl, property); } else { addScalarProperty(configEl, property); } } Serializer serializer = new Serializer(output, "utf-8"); serializer.setIndent(4); serializer.setMaxLength(160); serializer.write(new Document(configEl)); }
Serializer serializer = new Serializer(out, "ISO-8859-1"); serializer.setIndent(4); serializer.setMaxLength(128); serializer.write(doc);
Serializer serializer = new Serializer(out, "ISO-8859-1"); serializer.setIndent(4); serializer.setMaxLength(128); serializer.write(doc);
serializer.setMaxLength(160); serializer.write(new Document(schemaEl));