Java XML Transform transformerExceptionMsg(TransformerException ex, Node contextNode, String str)

Here you can find the source of transformerExceptionMsg(TransformerException ex, Node contextNode, String str)

Description

transformer Exception Msg

License

Open Source License

Declaration

private static void transformerExceptionMsg(TransformerException ex, Node contextNode, String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.xml.transform.TransformerException;

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Main {
    private static void transformerExceptionMsg(TransformerException ex, Node contextNode, String str) {
        System.out.println("[XPathUtil] Transformer exception selecting " + "XObject for " + "XPath String " + str
                + " with context node " + nodeToString(contextNode) + ": " + ex);
    }//from   ww w  .  j  av  a2s  .  co  m

    public static String nodeToString(Node node) {
        String ret = "<null/>";
        if (node != null) {
            ret = "<" + node.getNodeName() + " ";
            NamedNodeMap attrs = node.getAttributes();
            if (attrs != null) {
                for (int i = 0; i < attrs.getLength(); i++) {
                    Node attr = (Node) attrs.item(i);
                    ret = ret + attr.getNodeName() + "='";
                    ret = ret + attr.getNodeValue() + "' ";
                }
            }
            ret = ret + "/>";
        }
        return ret;
    }
}

Related

  1. transform(String xmlsource, File xsltfile)
  2. transform(String xslSource, Node original)
  3. transform(Transformer transformer, Node element)
  4. transformar(String xmlOrigen, String xslOrigen)
  5. transformer()
  6. transformerFactory()
  7. transformFile(Source stylesheetFile, File input, File output)
  8. transformLogViaXSLT(String logFilePath, String xslFilePath)
  9. transformNonTextNodeToOutputStream(Node node, OutputStream os, boolean omitXmlDeclaration)