diff --git a/source/java/writer2latex/xhtml/Debug.java b/source/java/writer2latex/xhtml/Debug.java new file mode 100644 index 0000000..ba4f162 --- /dev/null +++ b/source/java/writer2latex/xhtml/Debug.java @@ -0,0 +1,35 @@ +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(); + } + + + + } +}