List of utility methods to do XML Transform
TransformerHandler | createTransformerHandler(int indent) create Transformer Handler if (saxTransformerFactory == null) { TransformerFactory tf = TransformerFactory.newInstance(); if (!tf.getFeature(SAXTransformerFactory.FEATURE)) throw new SAXException("The TransformerFactory is not a SAXTransformerFactory"); saxTransformerFactory = (SAXTransformerFactory) tf; try { saxTransformerFactory.setAttribute("indent-number", Integer.toString(indent)); ... |
String | createTXT(Transformer xf, Node doc) create TXT OutputStream os = new ByteArrayOutputStream(); StreamResult res = new StreamResult(os); xf.transform(new DOMSource(doc), res); os.close(); return os.toString(); |
String | exceptionToString(TransformerException exception, boolean showSystemId) exception To String StringBuffer message = new StringBuffer(20); if (exception.getLocator() != null) { SourceLocator locator = exception.getLocator(); appendLocation(message, showSystemId ? locator.getSystemId() : null, locator.getLineNumber(), locator.getColumnNumber()); message.append(exception.getMessage()); return message.toString(); ... |
Transformer | getDefaultTransformerFactoryThreadLocal() get Default Transformer Factory Thread Local return DEFAULT_TRANSFORMER_THREAD_LOCAL.get();
|
Transformer | getNewTransformer() get New Transformer return defaultTransformerFactory.get().newTransformer();
|
Transformer | getThreadedIdentityTransformer(boolean omitXmlDeclaration) Get a thread-safe Transformer without an assigned transform. return getTransformer(omitXmlDeclaration, null);
|
Transformer | getThreadedIdentityTransformer(final boolean omitXmlDeclaration) Get a thread-safe Transformer without an assigned transform. return getThreadedTransformer(omitXmlDeclaration, null, (String) null);
|
Transformer | getThreadedTransformer(final boolean omitXmlDeclaration, final boolean standalone, final Map threadMap, final String xslURL) get Threaded Transformer final Thread currentThread = Thread.currentThread(); Transformer transformer = null; if (threadMap != null) { transformer = (Transformer) threadMap.get(currentThread); if (transformer == null) { if (xslURL == null) { transformer = tFactory.newTransformer(); ... |
String | getTransformedText(File doc, File xsl, Object[] params) Transform an XML file using an XSL file and an array of parameters. return getTransformedText(new StreamSource(doc), new StreamSource(xsl), params); |
Transformer | getTransformer() get Transformer TransformerFactory tf = TransformerFactory.newInstance();
return tf.newTransformer();
|