public String elementOutput(Element e) { return "\n\t" + new XMLOutputter().outputString(e); }
public String xmlRepresentation() { if (cachedXmlRepresentation == null) { cachedXmlRepresentation = new XMLOutputter().outputString(ccTrayXmlElement(SITE_URL_PREFIX)); } return cachedXmlRepresentation; }
public void modifyOutputStream( JarOutputStream jos ) throws IOException { jos.putNextEntry( new JarEntry( resource ) ); new XMLOutputter( Format.getPrettyFormat() ).output( doc, jos ); doc = null; } }
private static XMLOutputter xmlOutputer() { Format format = Format.getPrettyFormat().setEncoding("utf-8").setLineSeparator("\n"); return new XMLOutputter(format); }
/** * This returns a <code>String</code> representation of the * <code>DocType</code>, suitable for debugging. * * @return <code>String</code> - information about the * <code>DocType</code> */ @Override public String toString() { return new StringBuilder() .append("[DocType: ") .append(new org.jdom2.output.XMLOutputter().outputString(this)) .append("]") .toString(); }
/** * Gets the character stream for this input source. * <p> * Note that this method is only provided to make this * InputSource implementation acceptable by any XML * parser. As it generates an in-memory string representation * of the JDOM document, it is quite inefficient from both * speed and memory consumption points of view. * </p> * * @return a Reader to a string representation of the * source JDOM document. */ @Override public Reader getCharacterStream() { Reader reader = null; if (docsource != null) { // Get an in-memory string representation of the document // and return a reader on it. reader = new StringReader( new XMLOutputter().outputString(docsource)); } else if (listsource != null) { reader = new StringReader( new XMLOutputter().outputString(listsource)); } // Else: No source, no reader! return reader; } /**
/** * This returns a <code>String</code> representation of the * <code>ProcessingInstruction</code>, suitable for debugging. If the XML * representation of the <code>ProcessingInstruction</code> is desired, * {@link org.jdom2.output.XMLOutputter#outputString(ProcessingInstruction)} * should be used. * * @return <code>String</code> - information about the * <code>ProcessingInstruction</code> */ @Override public String toString() { return new StringBuilder() .append("[ProcessingInstruction: ") .append(new org.jdom2.output.XMLOutputter().outputString(this)) .append("]") .toString(); }
/** * This returns a <code>String</code> representation of the * <code>Comment</code>, suitable for debugging. If the XML * representation of the <code>Comment</code> is desired, * {@link org.jdom2.output.XMLOutputter#outputString(Comment)} * should be used. * * @return <code>String</code> - information about the * <code>Comment</code> */ @Override public String toString() { return new StringBuilder() .append("[Comment: ") .append(new org.jdom2.output.XMLOutputter().outputString(this)) .append("]") .toString(); }
String dtdDoc = new XMLOutputter().outputString(docType);
protected String getXmlInnerText(final Element e) { final StringBuffer sb = new StringBuffer(); final XMLOutputter xo = new XMLOutputter(); final List<Content> children = e.getContent(); sb.append(xo.outputString(children)); return sb.toString(); } }
protected String getXmlInnerText(final Element e) { final StringBuffer sb = new StringBuffer(); final XMLOutputter xo = new XMLOutputter(); final List<Content> children = e.getContent(); sb.append(xo.outputString(children)); return sb.toString(); } }
/** * Write the information as an XML document * * @param doc write XML for this Document * @param os write to this output stream * @throws java.io.IOException on write error */ public void writeXML(Document doc, OutputStream os) throws IOException { XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat()); fmt.output(doc, os); }
public static void outputDocument( final Document document, final OutputStream outputStream ) throws IOException { final Format format = Format.getPrettyFormat(); format.setEncoding( STORAGE_CHARSET.toString() ); final XMLOutputter outputter = new XMLOutputter(); outputter.setFormat( format ); try ( Writer writer = new OutputStreamWriter( outputStream, STORAGE_CHARSET ) ) { outputter.output( document, writer ); } }
private void doXmlOutputter(Document doc, File xmlFile) throws IOException { Format format = Format.getPrettyFormat(); format.setIndent(" "); format.setEncoding("UTF-8"); XMLOutputter out = new XMLOutputter(format); out.output(doc, new FileWriter(xmlFile)); // 写文件 }
public void writeCapabilitiesReport( PrintWriter pw ) throws WcsException, IOException { XMLOutputter xmlOutputter = new XMLOutputter( org.jdom2.output.Format.getPrettyFormat() ); xmlOutputter.output( getCapabilitiesReport(), pw ); }
/** * Write stationObsDataset XML document */ public String writeStationObsDatasetXML() { XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat()); return fmt.outputString(makeStationObsDatasetDocument()); }
public static void writeCoordRefSysAsGML( PrintWriter pw, ucar.nc2.dataset.CoordinateSystem coordSys ) throws IOException { XMLOutputter xmlOutputter = new XMLOutputter( org.jdom2.output.Format.getPrettyFormat() ); xmlOutputter.output( genCoordRefSysAsGML( coordSys), pw ); }
/** * Write the XML representaion to an OutputStream. * * @param out write to this OutputStream * @throws IOException on io error */ public void writeXML(OutputStream out) throws IOException { XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat()); fmt.output(writeDocument(), out); }
/** * Returns a string containing the XML content of a KAFDocument object. */ static String kafToStr(KAFDocument kaf) { XMLOutputter out = new XMLOutputter(Format.getPrettyFormat().setLineSeparator(LineSeparator.UNIX)); // out.getFormat().setTextMode(Format.TextMode.PRESERVE); Document jdom = KAFToDOM(kaf); return out.outputString(jdom); }
private void writeOneItem( InvDataset ds, OutputStream out) throws IOException { Element rootElem = new Element("dc", defNS); Document doc = new Document(rootElem); writeDataset( ds, rootElem); rootElem.addNamespaceDeclaration(XMLEntityResolver.xsiNS); // rootElem.setAttribute("schemaLocation", schemaLocation, XMLEntityResolver.xsiNS); rootElem.setAttribute("schemaLocation", defNS.getURI()+" "+schemaLocation, XMLEntityResolver.xsiNS); // Output the document, use standard formatter //XMLOutputter fmt = new XMLOutputter(" ", true); XMLOutputter fmt = new XMLOutputter( Format.getPrettyFormat()); fmt.output( doc, out); }