/** * Indents XML to be more readable, avoiding any whitespace * injection into CDATA if the preserveCData flag is set. */ public static String indentXML(String xml, boolean preserveCData) { return indentXML(xml, 3, preserveCData); }
/** Indents XML by the given spacing to be more readable. */ public static String indentXML(String xml, int spacing) { return indentXML(xml, spacing, false); }
/** * Indents XML to be more readable. * Uses 3 spaces to indent, and may indent CDATA. * * @param xml the XML string to format * @return the formatted XML string * @see #indentXML(String, int, boolean) */ public static String indentXML(String xml) { return indentXML(xml, 3, false); }
/** * Indents XML by the given spacing to be more readable. * CDATA may be indented. * * @param xml the XML string to format * @param spacing the number of spaces by which to indent * @return the formatted XML string * @see #indentXML(String, int, boolean) */ public static String indentXML(String xml, int spacing) { return indentXML(xml, spacing, false); }
/** * Indents XML to be more readable, avoiding any whitespace * injection into CDATA if the preserveCData flag is set. * Uses 3 spaces to indent. * * @param xml the XML string to format * @param preserveCData true if CDATA nodes should be preserved * with no indenting * @return the formatted XML string * @see #indentXML(String, int, boolean) */ public static String indentXML(String xml, boolean preserveCData) { return indentXML(xml, 3, preserveCData); }
/** Indents XML to be more readable. */ public static String indentXML(String xml) { return indentXML(xml, 3, false); }
public static void process(BufferedReader in, boolean keepValid) throws IOException { StringBuffer sb = new StringBuffer(); while (true) { String line = in.readLine(); if (line == null) break; sb.append(line); } in.close(); System.out.println(XMLTools.indentXML(sb.toString(), 3, keepValid)); }
LOGGER.info("{}", XMLTools.indentXML(xml, xmlSpaces, true)); if (omexmlOnly) { DebugTools.setRootLevel("OFF");
String companionXML = getOMEXML(companion); PrintWriter out = new PrintWriter(companion, Constants.ENCODING); out.println(XMLTools.indentXML(companionXML, true)); out.close(); companionUUID = "urn:uuid:" + getUUID(
String companionXML = getOMEXML(companion); PrintWriter out = new PrintWriter(companion, Constants.ENCODING); out.println(XMLTools.indentXML(companionXML, true)); out.close(); companionUUID = "urn:uuid:" + getUUID(
/** * Translates the given metadata to {@link OMEMetadata} and logs the XML. */ private void printOMEXML(final Metadata meta) { final SCIFIO scifio = new SCIFIO(meta.getContext()); final OMEMetadata omexml = new OMEMetadata(scifio.getContext()); scifio.translator().translate(meta, omexml, false); log().info(XMLTools.indentXML(omexml.getRoot().dumpXML(), xmlIndent, true)); }