List of utility methods to do XML Transform
void | applyXSLTTransform(final String xslt, final Reader input, final Writer output) apply XSLT Transform applyXSLTTransform(new StringReader(xslt), input, output);
|
Transformer | buildXmlTransformer() build Xml Transformer TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
return transformer;
|
Transformer | createIndentingTransformer() create Indenting Transformer Transformer transformer; try { TRANSFORMER_FACTORY.setAttribute("indent-number", 4); transformer = TRANSFORMER_FACTORY.newTransformer(); } catch (final Exception e) { throw new IllegalStateException(e); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); ... |
Transformer | createOutputTransformer(String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); sb.append( "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xalan=\"http://xml.apache.org/xslt\" version=\"1.0\">\n"); sb.append("<xsl:output method=\"xml\" encoding=\""); sb.append(encoding == null ? "UTF-8" : encoding); sb.append("\""); if (omitXmlDeclaration) { ... |
Transformer | createPrettyTransformer(int indent) Creates a Transformer with a configuration that affects the output of the transformed xml.
TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indent)); return transformer; |
Transformer | createTransformer() Create a Transformer just the way we like it. final Transformer xform; try { xform = m_xformFactory.newTransformer(); } catch (TransformerConfigurationException e) { throw new IllegalStateException(e); xform.setOutputProperty(OutputKeys.INDENT, "yes"); xform.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2"); ... |
Transformer | createTransformer() Create and returns a new Transformer. initFactories(); final Transformer result; try { result = transformerFactory.newTransformer(); } catch (TransformerConfigurationException e) { return null; result.setOutputProperty(OutputKeys.METHOD, "xml"); ... |
Transformer | createTransformer() Creates a Transformer instance. Transformer xmlTransformer = TransformerFactory.newInstance().newTransformer(); xmlTransformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); xmlTransformer.setOutputProperty(OutputKeys.INDENT, "yes"); return xmlTransformer; |
Transformer | createTransformer() Creates and configures Transformer object if (s_transformerFactory == null) { synchronized (TransformerFactory.class) { if (s_transformerFactory == null) { s_transformerFactory = TransformerFactory.newInstance(); Transformer transformer = s_transformerFactory.newTransformer(); ... |
Transformer | createTransformer(final File xsltFile) create Transformer return createTransformer(xsltFile, Collections.<String, String>emptyMap());
|