Class XmlDocxSorter


  • public class XmlDocxSorter
    extends java.lang.Object
    Pretty-prints docx xml, supplied as a string. putting parts in the following order:

    pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:name="/word/_rels/document.xml.rels" pkg:contentType="application/vnd.openxmlformats-package.core-properties+xml" pkg:name="/docProps/core.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" pkg:name="/docProps/app.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" pkg:name="/word/header%d.xml" where %d is 1,2,3... pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" pkg:name="/word/footer%d.xml" where %d is 1,2,3... pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:name="/word/_rels/footnotes.xml.rels" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" pkg:name="/word/footnotes.xml" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:name="/word/_rels/endnotes.xml.rels" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" pkg:name="/word/endnotes.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" pkg:name="/word/settings.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml" pkg:name="/word/webSettings.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" pkg:name="/word/styles.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" pkg:name="/word/numbering.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" pkg:name="/word/fontTable.xml" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:name="/customXml/_rels/item%d.xml.rels" where %d is 1,2,3... pkg:contentType="application/xml" pkg:name="/customXml/item%d.xml" where %d is 1,2,3... pkg:contentType="application/vnd.openxmlformats-officedocument.customXmlProperties+xml" pkg:name="/customXml/itemProps%d.xml" where %d is 1,2,3... pkg:contentType="application/vnd.openxmlformats-officedocument.theme+xml" pkg:name="/word/theme/theme%d.xml" where %d is 1,2,3... pkg:contentType="application/vnd.ms-word.stylesWithEffects+xml" pkg:name="/word/stylesWithEffects.xml"

    eg. String formattedXml = mlDocxSorter.sortDocumentParts(docxText);

    StackOverflow: https://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java

    • Constructor Summary

      Constructors 
      Constructor Description
      XmlDocxSorter()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String sortDocumentParts​(java.lang.String xml)  
      • Methods inherited from class java.lang.Object

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

      • XmlDocxSorter

        public XmlDocxSorter()
    • Method Detail

      • sortDocumentParts

        public static java.lang.String sortDocumentParts​(java.lang.String xml)