added Debug class
This commit is contained in:
parent
681d64375f
commit
a3c3aa095d
1 changed files with 35 additions and 0 deletions
35
source/java/writer2latex/xhtml/Debug.java
Normal file
35
source/java/writer2latex/xhtml/Debug.java
Normal file
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue