/** Wraps each item in the result sequence into a decorated element wrapper. */ private static Document wrapSequence(Nodes nodes) { // make a copy of the template for sequences: Element items = (Element) TEMPLATES.get(Nodes.class.getName()); items = new Element(items); int size = nodes.size(); for (int i=0; i < size; i++) { items.appendChild(wrap(nodes.get(i))); } return new Document(items); }
/** * Serializes the given result sequence onto the given output stream. * This method does not auto-close the output stream. * * @param nodes * the result sequence to serialize * @param out * the stream to write to * @throws IOException * if an I/O error occured */ public void write(Nodes nodes, OutputStream out) throws IOException { SequenceSerializer ser; if (W3C_ALGORITHM.equals(getAlgorithm())) { ser = new W3CSerializer(out, getEncoding()); } else { ser = new WrapSerializer(out, getEncoding()); } ser.setIndent(getIndent()); ser.setUnicodeNormalizationFormC(getUnicodeNormalizationFormC()); // ser.setLineSeparator(getLineSeparator()); // ser.setMaxLength(getMaxLength()); // ser.setPreserveBaseURI(getPreserveBaseURI()); ser.write(nodes); }
/** * Serializes the given result sequence onto the given output stream. * This method does not auto-close the output stream. * * @param nodes * the result sequence to serialize * @param out * the stream to write to * @throws IOException * if an I/O error occured */ public void write(Nodes nodes, OutputStream out) throws IOException { SequenceSerializer ser; if (W3C_ALGORITHM.equals(getAlgorithm())) { ser = new W3CSerializer(out, getEncoding()); } else { ser = new WrapSerializer(out, getEncoding()); } ser.setIndent(getIndent()); ser.setUnicodeNormalizationFormC(getUnicodeNormalizationFormC()); // ser.setLineSeparator(getLineSeparator()); // ser.setMaxLength(getMaxLength()); // ser.setPreserveBaseURI(getPreserveBaseURI()); ser.write(nodes); }
public void write(Nodes nodes) throws IOException { Document doc = wrapSequence(nodes); write(doc); }
public void write(Nodes nodes) throws IOException { Document doc = wrapSequence(nodes); write(doc); }
/** Wraps each item in the result sequence into a decorated element wrapper. */ private static Document wrapSequence(Nodes nodes) { // make a copy of the template for sequences: Element items = (Element) TEMPLATES.get(Nodes.class.getName()); items = new Element(items); int size = nodes.size(); for (int i=0; i < size; i++) { items.appendChild(wrap(nodes.get(i))); } return new Document(items); }