public static void generateXMLFile(Element element, Writer writer) { try { Transformer it = newTransformer(); it.setOutputProperty(OutputKeys.METHOD, "xml"); it.setOutputProperty(OutputKeys.INDENT, "yes"); it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); it.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); it.transform(new DOMSource(element), new StreamResult(writer)); } catch (Exception e) { e.printStackTrace(); } }
public static void generateXMLFile(Element element, Writer writer) { try { Transformer it = newTransformer(); it.setOutputProperty(OutputKeys.METHOD, "xml"); it.setOutputProperty(OutputKeys.INDENT, "yes"); it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); it.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); it.transform(new DOMSource(element), new StreamResult(writer)); } catch (Exception e) { e.printStackTrace(); } }
public static void generateXMLFile(Element element, Writer writer) { try { Transformer it = newTransformer(); it.setOutputProperty(OutputKeys.METHOD, "xml"); it.setOutputProperty(OutputKeys.INDENT, "yes"); it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); it.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); it.transform(new DOMSource(element), new StreamResult(writer)); } catch (Exception e) { e.printStackTrace(); } }
public static String toString(Source source, Properties props) throws TransformerException, IOException { StringWriter bos = new StringWriter(); StreamResult sr = new StreamResult(bos); Transformer trans = newTransformer(); if (props == null) { props = new Properties(); props.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); } trans.setOutputProperties(props); trans.transform(source, sr); bos.close(); return bos.toString(); }
public static String toString(Source source, Properties props) throws TransformerException, IOException { StringWriter bos = new StringWriter(); StreamResult sr = new StreamResult(bos); Transformer trans = newTransformer(); if (props == null) { props = new Properties(); props.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); } trans.setOutputProperties(props); trans.transform(source, sr); bos.close(); return bos.toString(); }
public static String toString(Source source, Properties props) throws TransformerException, IOException { StringWriter bos = new StringWriter(); StreamResult sr = new StreamResult(bos); Transformer trans = newTransformer(); if (props == null) { props = new Properties(); props.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); } trans.setOutputProperties(props); trans.transform(source, sr); bos.close(); return bos.toString(); }
public static void writeTo(Source src, OutputStream os, int indent, String charset, String omitXmlDecl) { Transformer it; try { if (StringUtils.isEmpty(charset)) { charset = "utf-8"; } it = newTransformer(indent); it.setOutputProperty(OutputKeys.METHOD, "xml"); if (indent > -1) { it.setOutputProperty(OutputKeys.INDENT, "yes"); it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", Integer.toString(indent)); } it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl); it.setOutputProperty(OutputKeys.ENCODING, charset); it.transform(src, new StreamResult(os)); } catch (TransformerException e) { throw new RuntimeException("Failed to configure TRaX", e); } } public static void writeTo(Source src,
public static void writeTo(Source src, OutputStream os, int indent, String charset, String omitXmlDecl) { Transformer it; try { if (StringUtils.isEmpty(charset)) { charset = "utf-8"; } it = newTransformer(indent); it.setOutputProperty(OutputKeys.METHOD, "xml"); if (indent > -1) { it.setOutputProperty(OutputKeys.INDENT, "yes"); it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", Integer.toString(indent)); } it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl); it.setOutputProperty(OutputKeys.ENCODING, charset); it.transform(src, new StreamResult(os)); } catch (TransformerException e) { throw new RuntimeException("Failed to configure TRaX", e); } } public static void writeTo(Source src,
public static void writeTo(Source src, Writer os, int indent, String charset, String omitXmlDecl) { Transformer it; try { if (StringUtils.isEmpty(charset)) { charset = "utf-8"; } it = newTransformer(indent); it.setOutputProperty(OutputKeys.METHOD, "xml"); if (indent > -1) { it.setOutputProperty(OutputKeys.INDENT, "yes"); it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", Integer.toString(indent)); } it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl); it.setOutputProperty(OutputKeys.ENCODING, charset); it.transform(src, new StreamResult(os)); } catch (TransformerException e) { throw new RuntimeException("Failed to configure TRaX", e); } } public static String toString(Source source) throws TransformerException, IOException {
public static void writeTo(Source src, Writer os, int indent, String charset, String omitXmlDecl) { Transformer it; try { if (StringUtils.isEmpty(charset)) { charset = "utf-8"; } it = newTransformer(indent); it.setOutputProperty(OutputKeys.METHOD, "xml"); if (indent > -1) { it.setOutputProperty(OutputKeys.INDENT, "yes"); it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", Integer.toString(indent)); } it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl); it.setOutputProperty(OutputKeys.ENCODING, charset); it.transform(src, new StreamResult(os)); } catch (TransformerException e) { throw new RuntimeException("Failed to configure TRaX", e); } } public static String toString(Source source) throws TransformerException, IOException {
public static void writeTo(Source src, Writer os, int indent, String charset, String omitXmlDecl) { Transformer it; try { if (StringUtils.isEmpty(charset)) { charset = "utf-8"; } it = newTransformer(indent); it.setOutputProperty(OutputKeys.METHOD, "xml"); if (indent > -1) { it.setOutputProperty(OutputKeys.INDENT, "yes"); it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", Integer.toString(indent)); } it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl); it.setOutputProperty(OutputKeys.ENCODING, charset); it.transform(src, new StreamResult(os)); } catch (TransformerException e) { throw new RuntimeException("Failed to configure TRaX", e); } } public static String toString(Source source) throws TransformerException, IOException {
public static void writeTo(Source src, OutputStream os, int indent, String charset, String omitXmlDecl) { Transformer it; try { if (StringUtils.isEmpty(charset)) { charset = "utf-8"; } it = newTransformer(indent); it.setOutputProperty(OutputKeys.METHOD, "xml"); if (indent > -1) { it.setOutputProperty(OutputKeys.INDENT, "yes"); it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", Integer.toString(indent)); } it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl); it.setOutputProperty(OutputKeys.ENCODING, charset); it.transform(src, new StreamResult(os)); } catch (TransformerException e) { throw new RuntimeException("Failed to configure TRaX", e); } } public static void writeTo(Source src,