Class UtilXml


  • public final class UtilXml
    extends java.lang.Object
    Utilities methods to simplify dealing with JAXP and DOM XML parsing
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  UtilXml.LocalErrorHandler
      Local error handler for entity resolver to DocumentBuilder parser.
      static class  UtilXml.LocalResolver
      Local entity resolver to handle J2EE DTDs.
    • Field Summary

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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.w3c.dom.Element addChildElement​(org.w3c.dom.Element element, java.lang.String childElementName, org.w3c.dom.Document document)
      Creates a child element with the given name and appends it to the element child node list.
      static org.w3c.dom.Element addChildElementCDATAValue​(org.w3c.dom.Element element, java.lang.String childElementName, java.lang.String childElementValue, org.w3c.dom.Document document)
      Creates a child element with the given name and appends it to the element child node list.
      static org.w3c.dom.Element addChildElementNSElement​(org.w3c.dom.Element element, java.lang.String childElementName, org.w3c.dom.Document document, java.lang.String nameSpaceUrl)
      Creates a child element with the given namespace supportive name and appends it to the element child node list.
      static org.w3c.dom.Element addChildElementNSValue​(org.w3c.dom.Element element, java.lang.String childElementName, java.lang.String childElementValue, org.w3c.dom.Document document, java.lang.String nameSpaceUrl)
      Creates a child element with the given namespace supportive name and appends it to the element child node list.
      static org.w3c.dom.Element addChildElementValue​(org.w3c.dom.Element element, java.lang.String childElementName, java.lang.String childElementValue, org.w3c.dom.Document document)
      Creates a child element with the given name and appends it to the element child node list.
      static boolean checkBoolean​(java.lang.String str)  
      static boolean checkBoolean​(java.lang.String str, boolean defaultValue)  
      static java.lang.String checkEmpty​(java.lang.String string)  
      static java.lang.String checkEmpty​(java.lang.String string1, java.lang.String string2)  
      static java.lang.String checkEmpty​(java.lang.String string1, java.lang.String string2, java.lang.String string3)  
      static java.lang.String childElementAttribute​(org.w3c.dom.Element element, java.lang.String childElementName, java.lang.String attributeName, java.lang.String defaultValue)
      Return a named attribute of a named child node or a default if null.
      static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.DocumentFragment fragment)
      Return a List of Element objects that are children of the given DocumentFragment
      static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.Element element)
      Return a List of Element objects that are children of the given element
      static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.Element element, java.lang.String childElementName)
      Return a List of Element objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included.
      static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.Element element, java.lang.String... childElementNames)
      Return a List of Element objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included.
      static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.Element element, java.util.Set<java.lang.String> childElementNames)
      Return a List of Element objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included.
      static java.lang.String childElementValue​(org.w3c.dom.Element element, java.lang.String childElementName)
      Return the text (node value) contained by the named child node.
      static java.lang.String childElementValue​(org.w3c.dom.Element element, java.lang.String childElementName, java.lang.String defaultValue)
      Return the text (node value) contained by the named child node or a default value if null.
      static java.util.List<? extends org.w3c.dom.Node> childNodeList​(org.w3c.dom.Node node)
      Return a List of Node objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included.
      static java.lang.String convertDocumentToXmlString​(org.w3c.dom.Document document)  
      static org.w3c.dom.Comment createApacheLicenceComment​(org.w3c.dom.Document document)
      Returns an ASF Licence Header as a Comment Element
      static org.w3c.dom.ls.LSOutput createLSOutput​(org.w3c.dom.ls.DOMImplementationLS impl, java.io.OutputStream os, java.lang.String encoding)
      Returns a LSOutput instance.
      static org.w3c.dom.ls.LSSerializer createLSSerializer​(org.w3c.dom.ls.DOMImplementationLS impl, boolean includeXmlDeclaration, boolean enablePrettyPrint)
      Returns a LSSerializer instance.
      static javax.xml.transform.Transformer createOutputTransformer​(java.lang.String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)
      Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document.
      static java.lang.String elementAttribute​(org.w3c.dom.Element element, java.lang.String attrName, java.lang.String defaultValue)  
      static java.lang.String elementValue​(org.w3c.dom.Element element)
      Return the text (node value) of the first node under this, works best if normalized.
      static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element)
      Return the first child Element returns the first element.
      static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element, java.lang.String childElementName)
      Return the first child Element with the given name; if name is null returns the first element.
      static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element, java.lang.String... childElementNames)
      Return the first child Element returns the first element.
      static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element, java.lang.String childElementName, java.lang.String attrName, java.lang.String attrValue)
      Return the first child Element with the given name; if name is null returns the first element.
      static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element, java.util.Set<java.lang.String> childElementNames)
      Return the first child Element returns the first element.
      static java.lang.Object fromXml​(java.io.InputStream input)
      Deserialize an object from an InputStream.
      static java.lang.Object fromXml​(java.io.Reader reader)
      Deserialize an object from a Reader.
      static java.lang.Object fromXml​(java.lang.String str)
      Deserialize an object from a String.
      static java.lang.String getAttributeValueIgnorePrefix​(org.w3c.dom.Element element, java.lang.String attributeName)
      get attribute value ignoring prefix in attribute name
      static org.w3c.dom.ls.DOMImplementationLS getDomLsImplementation()
      Returns a DOMImplementationLS instance.
      static java.lang.String getNodeNameIgnorePrefix​(org.w3c.dom.Node node)
      get node name without any prefix
      static java.lang.String getTagNameIgnorePrefix​(org.w3c.dom.Element element)
      get tag name without any prefix
      static org.w3c.dom.Document makeEmptyXmlDocument()  
      static org.w3c.dom.Document makeEmptyXmlDocument​(java.lang.String rootElementName)  
      static java.lang.String nodeNameToJavaName​(java.lang.String nodeName, boolean capitalizeFirst)  
      static java.lang.String nodeValue​(org.w3c.dom.Node node)
      Return the text (node value) of the first node under this
      static org.w3c.dom.Document readXmlDocument​(java.io.InputStream is, boolean validate, java.lang.String docDescription)  
      static org.w3c.dom.Document readXmlDocument​(java.io.InputStream is, boolean validate, java.lang.String docDescription, boolean withPosition)  
      static org.w3c.dom.Document readXmlDocument​(java.io.InputStream is, java.lang.String docDescription)  
      static org.w3c.dom.Document readXmlDocument​(java.io.InputStream is, java.lang.String docDescription, boolean withPosition)  
      static org.w3c.dom.Document readXmlDocument​(java.lang.String content)  
      static org.w3c.dom.Document readXmlDocument​(java.lang.String content, boolean validate)  
      static org.w3c.dom.Document readXmlDocument​(java.lang.String content, boolean validate, boolean withPosition)  
      static org.w3c.dom.Document readXmlDocument​(java.net.URL url)  
      static org.w3c.dom.Document readXmlDocument​(java.net.URL url, boolean validate)  
      static org.w3c.dom.Document readXmlDocument​(java.net.URL url, boolean validate, boolean withPosition)  
      static java.lang.String toXml​(java.lang.Object obj)
      Serialize an object to an XML String.
      static void toXml​(java.lang.Object obj, java.io.OutputStream output)
      Serialize an object to an OutputStream.
      static void toXml​(java.lang.Object obj, java.io.Writer writer)
      Serialize an object to a Writer.
      static void transformDomDocument​(javax.xml.transform.Transformer transformer, org.w3c.dom.Node node, java.io.OutputStream os)
      Serializes a DOM Node to an OutputStream using JAXP TrAX.
      static void writeXmlDocument​(java.io.OutputStream os, org.w3c.dom.Node node)  
      static void writeXmlDocument​(java.io.OutputStream os, org.w3c.dom.Node node, java.lang.String encoding, boolean includeXmlDeclaration, boolean enablePrettyPrint)
      Serializes a DOM Node to an OutputStream using DOM 3.
      static void writeXmlDocument​(java.lang.String filename, org.w3c.dom.Node node)  
      static java.lang.String writeXmlDocument​(org.w3c.dom.Node node)  
      static void writeXmlDocument​(org.w3c.dom.Node node, java.io.OutputStream os, java.lang.String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)
      Serializes a DOM Node to an OutputStream using JAXP TrAX.
      • Methods inherited from class java.lang.Object

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

      • module

        public static final java.lang.String module
    • Method Detail

      • getDomLsImplementation

        public static org.w3c.dom.ls.DOMImplementationLS getDomLsImplementation()
                                                                         throws java.lang.ClassCastException,
                                                                                java.lang.ClassNotFoundException,
                                                                                java.lang.InstantiationException,
                                                                                java.lang.IllegalAccessException
        Returns a DOMImplementationLS instance.
        Returns:
        A DOMImplementationLS instance
        Throws:
        java.lang.ClassCastException
        java.lang.ClassNotFoundException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        See Also:
        DOM Level 3 Load and Save Specification
      • createLSOutput

        public static org.w3c.dom.ls.LSOutput createLSOutput​(org.w3c.dom.ls.DOMImplementationLS impl,
                                                             java.io.OutputStream os,
                                                             java.lang.String encoding)
        Returns a LSOutput instance.
        Parameters:
        impl - A DOMImplementationLS instance
        os - Optional OutputStream instance
        encoding - Optional character encoding, default is UTF-8
        Returns:
        A LSOutput instance
        See Also:
        DOM Level 3 Load and Save Specification
      • createLSSerializer

        public static org.w3c.dom.ls.LSSerializer createLSSerializer​(org.w3c.dom.ls.DOMImplementationLS impl,
                                                                     boolean includeXmlDeclaration,
                                                                     boolean enablePrettyPrint)
        Returns a LSSerializer instance.
        Parameters:
        impl - A DOMImplementationLS instance
        includeXmlDeclaration - If set to true, the xml declaration will be included in the output
        enablePrettyPrint - If set to true, the output will be formatted in human-readable form. If set to false, the entire document will consist of a single line.
        Returns:
        A LSSerializer instance
        See Also:
        DOM Level 3 Load and Save Specification
      • writeXmlDocument

        public static void writeXmlDocument​(java.io.OutputStream os,
                                            org.w3c.dom.Node node,
                                            java.lang.String encoding,
                                            boolean includeXmlDeclaration,
                                            boolean enablePrettyPrint)
                                     throws java.lang.ClassCastException,
                                            java.lang.ClassNotFoundException,
                                            java.lang.InstantiationException,
                                            java.lang.IllegalAccessException
        Serializes a DOM Node to an OutputStream using DOM 3.
        Parameters:
        os - The OutputStream instance to write to
        node - The DOM Node object to be serialized
        encoding - Optional character encoding
        includeXmlDeclaration - If set to true, the xml declaration will be included in the output
        enablePrettyPrint - If set to true, the output will be formatted in human-readable form. If set to false, the entire document will consist of a single line.
        Throws:
        java.lang.ClassCastException
        java.lang.ClassNotFoundException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        See Also:
        DOM Level 3 Load and Save Specification
      • createOutputTransformer

        public static javax.xml.transform.Transformer createOutputTransformer​(java.lang.String encoding,
                                                                              boolean omitXmlDeclaration,
                                                                              boolean indent,
                                                                              int indentAmount)
                                                                       throws javax.xml.transform.TransformerConfigurationException
        Creates a JAXP TrAX Transformer suitable for pretty-printing an XML document. This method is provided as an alternative to the deprecated org.apache.xml.serialize.OutputFormat class.
        Parameters:
        encoding - Optional encoding, defaults to UTF-8
        omitXmlDeclaration - If true the xml declaration will be omitted from the output
        indent - If true, the output will be indented
        indentAmount - If indent is true, the number of spaces to indent. Default is 4.
        Returns:
        A Transformer instance
        Throws:
        javax.xml.transform.TransformerConfigurationException
        See Also:
        JAXP TrAX
      • transformDomDocument

        public static void transformDomDocument​(javax.xml.transform.Transformer transformer,
                                                org.w3c.dom.Node node,
                                                java.io.OutputStream os)
                                         throws javax.xml.transform.TransformerException
        Serializes a DOM Node to an OutputStream using JAXP TrAX.
        Parameters:
        transformer - A Transformer instance
        node - The Node to serialize
        os - The OutputStream to serialize to
        Throws:
        javax.xml.transform.TransformerException
        See Also:
        JAXP TrAX
      • writeXmlDocument

        public static void writeXmlDocument​(org.w3c.dom.Node node,
                                            java.io.OutputStream os,
                                            java.lang.String encoding,
                                            boolean omitXmlDeclaration,
                                            boolean indent,
                                            int indentAmount)
                                     throws javax.xml.transform.TransformerException
        Serializes a DOM Node to an OutputStream using JAXP TrAX.
        Parameters:
        node - The Node to serialize
        os - The OutputStream to serialize to
        encoding - Optional encoding, defaults to UTF-8
        omitXmlDeclaration - If true the xml declaration will be omitted from the output
        indent - If true, the output will be indented
        indentAmount - If indent is true, the number of spaces to indent. Default is 4.
        Throws:
        javax.xml.transform.TransformerException
        See Also:
        JAXP TrAX
      • fromXml

        public static java.lang.Object fromXml​(java.io.InputStream input)
        Deserialize an object from an InputStream.
        Parameters:
        input - The InputStream
        Returns:
        The deserialized Object
      • fromXml

        public static java.lang.Object fromXml​(java.io.Reader reader)
        Deserialize an object from a Reader.
        Parameters:
        reader - The Reader
        Returns:
        The deserialized Object
      • fromXml

        public static java.lang.Object fromXml​(java.lang.String str)
        Deserialize an object from a String.
        Parameters:
        str - The String
        Returns:
        The deserialized Object
      • toXml

        public static java.lang.String toXml​(java.lang.Object obj)
        Serialize an object to an XML String.
        Parameters:
        obj - The object to serialize
        Returns:
        An XML String
      • toXml

        public static void toXml​(java.lang.Object obj,
                                 java.io.OutputStream output)
        Serialize an object to an OutputStream.
        Parameters:
        obj - The object to serialize
        output - The OutputStream
      • toXml

        public static void toXml​(java.lang.Object obj,
                                 java.io.Writer writer)
        Serialize an object to a Writer.
        Parameters:
        obj - The object to serialize
        writer - The Writer
      • writeXmlDocument

        public static java.lang.String writeXmlDocument​(org.w3c.dom.Node node)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeXmlDocument

        public static void writeXmlDocument​(java.lang.String filename,
                                            org.w3c.dom.Node node)
                                     throws java.io.FileNotFoundException,
                                            java.io.IOException
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
      • writeXmlDocument

        public static void writeXmlDocument​(java.io.OutputStream os,
                                            org.w3c.dom.Node node)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.lang.String content)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.lang.String content,
                                                           boolean validate)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.lang.String content,
                                                           boolean validate,
                                                           boolean withPosition)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.net.URL url)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.net.URL url,
                                                           boolean validate)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.net.URL url,
                                                           boolean validate,
                                                           boolean withPosition)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.io.InputStream is,
                                                           java.lang.String docDescription)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.io.InputStream is,
                                                           java.lang.String docDescription,
                                                           boolean withPosition)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.io.InputStream is,
                                                           boolean validate,
                                                           java.lang.String docDescription)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • readXmlDocument

        public static org.w3c.dom.Document readXmlDocument​(java.io.InputStream is,
                                                           boolean validate,
                                                           java.lang.String docDescription,
                                                           boolean withPosition)
                                                    throws org.xml.sax.SAXException,
                                                           javax.xml.parsers.ParserConfigurationException,
                                                           java.io.IOException
        Throws:
        org.xml.sax.SAXException
        javax.xml.parsers.ParserConfigurationException
        java.io.IOException
      • makeEmptyXmlDocument

        public static org.w3c.dom.Document makeEmptyXmlDocument()
      • makeEmptyXmlDocument

        public static org.w3c.dom.Document makeEmptyXmlDocument​(java.lang.String rootElementName)
      • addChildElement

        public static org.w3c.dom.Element addChildElement​(org.w3c.dom.Element element,
                                                          java.lang.String childElementName,
                                                          org.w3c.dom.Document document)
        Creates a child element with the given name and appends it to the element child node list.
      • addChildElementValue

        public static org.w3c.dom.Element addChildElementValue​(org.w3c.dom.Element element,
                                                               java.lang.String childElementName,
                                                               java.lang.String childElementValue,
                                                               org.w3c.dom.Document document)
        Creates a child element with the given name and appends it to the element child node list. Also creates a Text node with the given value and appends it to the new elements child node list.
      • addChildElementNSElement

        public static org.w3c.dom.Element addChildElementNSElement​(org.w3c.dom.Element element,
                                                                   java.lang.String childElementName,
                                                                   org.w3c.dom.Document document,
                                                                   java.lang.String nameSpaceUrl)
        Creates a child element with the given namespace supportive name and appends it to the element child node list.
      • addChildElementNSValue

        public static org.w3c.dom.Element addChildElementNSValue​(org.w3c.dom.Element element,
                                                                 java.lang.String childElementName,
                                                                 java.lang.String childElementValue,
                                                                 org.w3c.dom.Document document,
                                                                 java.lang.String nameSpaceUrl)
        Creates a child element with the given namespace supportive name and appends it to the element child node list. Also creates a Text node with the given value and appends it to the new elements child node list.
      • addChildElementCDATAValue

        public static org.w3c.dom.Element addChildElementCDATAValue​(org.w3c.dom.Element element,
                                                                    java.lang.String childElementName,
                                                                    java.lang.String childElementValue,
                                                                    org.w3c.dom.Document document)
        Creates a child element with the given name and appends it to the element child node list. Also creates a CDATASection node with the given value and appends it to the new elements child node list.
      • childElementList

        public static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.Element element)
        Return a List of Element objects that are children of the given element
      • childElementList

        public static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.Element element,
                                                                                     java.lang.String childElementName)
        Return a List of Element objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included.
      • childElementList

        public static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.Element element,
                                                                                     java.util.Set<java.lang.String> childElementNames)
        Return a List of Element objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included.
      • childElementList

        public static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.Element element,
                                                                                     java.lang.String... childElementNames)
        Return a List of Element objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included.
      • childElementList

        public static java.util.List<? extends org.w3c.dom.Element> childElementList​(org.w3c.dom.DocumentFragment fragment)
        Return a List of Element objects that are children of the given DocumentFragment
      • childNodeList

        public static java.util.List<? extends org.w3c.dom.Node> childNodeList​(org.w3c.dom.Node node)
        Return a List of Node objects that have the given name and are immediate children of the given element; if name is null, all child elements will be included.
      • firstChildElement

        public static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element,
                                                            java.util.Set<java.lang.String> childElementNames)
        Return the first child Element returns the first element.
      • firstChildElement

        public static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element,
                                                            java.lang.String... childElementNames)
        Return the first child Element returns the first element.
      • firstChildElement

        public static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element)
        Return the first child Element returns the first element.
      • firstChildElement

        public static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element,
                                                            java.lang.String childElementName)
        Return the first child Element with the given name; if name is null returns the first element.
      • firstChildElement

        public static org.w3c.dom.Element firstChildElement​(org.w3c.dom.Element element,
                                                            java.lang.String childElementName,
                                                            java.lang.String attrName,
                                                            java.lang.String attrValue)
        Return the first child Element with the given name; if name is null returns the first element.
      • childElementValue

        public static java.lang.String childElementValue​(org.w3c.dom.Element element,
                                                         java.lang.String childElementName)
        Return the text (node value) contained by the named child node.
      • childElementValue

        public static java.lang.String childElementValue​(org.w3c.dom.Element element,
                                                         java.lang.String childElementName,
                                                         java.lang.String defaultValue)
        Return the text (node value) contained by the named child node or a default value if null.
      • childElementAttribute

        public static java.lang.String childElementAttribute​(org.w3c.dom.Element element,
                                                             java.lang.String childElementName,
                                                             java.lang.String attributeName,
                                                             java.lang.String defaultValue)
        Return a named attribute of a named child node or a default if null.
      • elementValue

        public static java.lang.String elementValue​(org.w3c.dom.Element element)
        Return the text (node value) of the first node under this, works best if normalized.
      • nodeValue

        public static java.lang.String nodeValue​(org.w3c.dom.Node node)
        Return the text (node value) of the first node under this
      • elementAttribute

        public static java.lang.String elementAttribute​(org.w3c.dom.Element element,
                                                        java.lang.String attrName,
                                                        java.lang.String defaultValue)
      • checkEmpty

        public static java.lang.String checkEmpty​(java.lang.String string)
      • checkEmpty

        public static java.lang.String checkEmpty​(java.lang.String string1,
                                                  java.lang.String string2)
      • checkEmpty

        public static java.lang.String checkEmpty​(java.lang.String string1,
                                                  java.lang.String string2,
                                                  java.lang.String string3)
      • checkBoolean

        public static boolean checkBoolean​(java.lang.String str)
      • checkBoolean

        public static boolean checkBoolean​(java.lang.String str,
                                           boolean defaultValue)
      • nodeNameToJavaName

        public static java.lang.String nodeNameToJavaName​(java.lang.String nodeName,
                                                          boolean capitalizeFirst)
      • getNodeNameIgnorePrefix

        public static java.lang.String getNodeNameIgnorePrefix​(org.w3c.dom.Node node)
        get node name without any prefix
        Parameters:
        node -
        Returns:
        nodeName
      • getTagNameIgnorePrefix

        public static java.lang.String getTagNameIgnorePrefix​(org.w3c.dom.Element element)
        get tag name without any prefix
        Parameters:
        element -
        Returns:
        tagName
      • getAttributeValueIgnorePrefix

        public static java.lang.String getAttributeValueIgnorePrefix​(org.w3c.dom.Element element,
                                                                     java.lang.String attributeName)
        get attribute value ignoring prefix in attribute name
        Parameters:
        element -
        Returns:
        The value of the node, depending on its type; see the table Node class
      • convertDocumentToXmlString

        public static java.lang.String convertDocumentToXmlString​(org.w3c.dom.Document document)
      • createApacheLicenceComment

        public static org.w3c.dom.Comment createApacheLicenceComment​(org.w3c.dom.Document document)
        Returns an ASF Licence Header as a Comment Element
        Parameters:
        document -
        Returns: