Class XmlStringPrettyFormatter


  • public class XmlStringPrettyFormatter
    extends java.lang.Object
    Format an XML String with indent = 2 space.

    Very much inspired by http://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java and http://pastebin.com/XL7932aC

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String FORMAT_ERROR  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String prettyFormat​(org.w3c.dom.Document document, boolean keepXmlDeclaration)  
      private static org.w3c.dom.Document toXmlDocument​(java.lang.String xmlString)  
      static java.lang.String xmlPrettyFormat​(java.lang.String xmlStringToFormat)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlStringPrettyFormatter

        private XmlStringPrettyFormatter()
    • Method Detail

      • xmlPrettyFormat

        public static java.lang.String xmlPrettyFormat​(java.lang.String xmlStringToFormat)
      • prettyFormat

        private static java.lang.String prettyFormat​(org.w3c.dom.Document document,
                                                     boolean keepXmlDeclaration)
      • toXmlDocument

        private static org.w3c.dom.Document toXmlDocument​(java.lang.String xmlString)