1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-27 00:32:07 +01:00

Fixed pretty printing of XML packet. SMACK-42

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2452 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-02-01 01:32:24 +00:00 committed by gaston
parent b6e862c0ee
commit e42ba10a3d

View file

@ -712,6 +712,12 @@ public class EnhancedDebugger implements SmackDebugger {
try { try {
// Use a Transformer for output // Use a Transformer for output
TransformerFactory tFactory = TransformerFactory.newInstance(); TransformerFactory tFactory = TransformerFactory.newInstance();
// Surround this setting in a try/catch for compatibility with Java 1.4. This setting is required
// for Java 1.5
try {
tFactory.setAttribute("indent-number", new Integer(2));
}
catch (IllegalArgumentException e) {}
Transformer transformer = tFactory.newTransformer(); Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "yes");