Class XMLUtil

    • Constructor Detail

      • XMLUtil

        public XMLUtil()
    • Method Detail

      • getInstance

        public static XMLUtil getInstance()
      • setInstance

        public static void setInstance​(XMLUtil instance)
      • createDomDocument

        public org.dom4j.Document createDomDocument()
        Returns:
        a new Dom4j Document
      • newSAXReader

        public org.dom4j.io.SAXReader newSAXReader()
                                            throws SAXException
        Returns:
        a new secure SAXReader
        Throws:
        SAXException
      • getRootElement

        public org.dom4j.Element getRootElement​(InputStream in)
        Parses provided InputStream into XML and extracts root element
        Parameters:
        in - InputStream XML
        Returns:
        Element root element
      • addRootElement

        public org.dom4j.Element addRootElement​(org.dom4j.Document doc,
                                                String elementName)
        Creates a standard Openbravo root element for a xml document and set ths namespace. Ads the new root element to the Dom4j document.
        Parameters:
        doc - the Dom4j document to set the root element
        elementName - the name of the root element
        Returns:
        the new root element
      • toString

        public String toString​(org.dom4j.Document document)
        Converts a Dom4j document to a string. A number of specific settings: 1) output encoding is UTF-8, 2) text nodes are not trimmed
        Parameters:
        document - the Dom4j to convert to a XML string
        Returns:
        the XML representation