w2phtml/source/java/writer2latex/xhtml/Debug.java
2020-12-13 14:08:04 +01:00

35 lines
1 KiB
Java

package writer2latex.xhtml;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Node;
public class Debug {
public static void printNode(Node node){
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer;
try {
transformer = transFactory.newTransformer();
StringWriter buffer = new StringWriter();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.transform(new DOMSource(node), new StreamResult(buffer));
String str = buffer.toString();
System.out.println(str);
} catch (TransformerConfigurationException e1) {
e1.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
}
}
}