diff options
Diffstat (limited to 'base/silent/src/com/netscape/pkisilent')
-rw-r--r-- | base/silent/src/com/netscape/pkisilent/common/ParseXML.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/base/silent/src/com/netscape/pkisilent/common/ParseXML.java b/base/silent/src/com/netscape/pkisilent/common/ParseXML.java index de1b38172..3e434498f 100644 --- a/base/silent/src/com/netscape/pkisilent/common/ParseXML.java +++ b/base/silent/src/com/netscape/pkisilent/common/ParseXML.java @@ -26,11 +26,13 @@ import java.util.ArrayList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import org.w3c.dom.bootstrap.DOMImplementationRegistry; +import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSOutput; +import org.w3c.dom.ls.LSSerializer; public class ParseXML { Document dom = null; @@ -99,14 +101,17 @@ public class ParseXML { public void prettyprintxml() { try { // Serialize the document - OutputFormat format = new OutputFormat(dom); + DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); + DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); - format.setLineWidth(65); - format.setIndenting(true); - format.setIndent(2); - XMLSerializer serializer = new XMLSerializer(System.out, format); + LSSerializer writer = impl.createLSSerializer(); + writer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE); + + LSOutput output = impl.createLSOutput(); + output.setByteStream(System.out); + + writer.write(dom, output); - serializer.serialize(dom); } catch (Exception e) { } } |