Class XMLUtils

    • Method Detail

      • getLogger

        protected org.slf4j.Logger getLogger()
        Returns the Logger.
        Returns:
        the Logger.
      • setLogger

        public void setLogger​(org.slf4j.Logger logger)
        Description copied from interface: LogEnabled
        Called at creation time to provide a Logger.
        Specified by:
        setLogger in interface LogEnabled
        Parameters:
        logger - a Logger for messages.
      • createElementIfNotNull

        public static void createElementIfNotNull​(ContentHandler contentHandler,
                                                  String localName,
                                                  String stringValue)
                                           throws SAXException
        Create a start and endElement with a empty Namespace and without Attributes If the string value is null, the element is not created
        Parameters:
        contentHandler - the ContentHandler that will receive the SAX events
        localName - The local name (without prefix)
        stringValue - The content of the Element
        Throws:
        SAXException - if an error occurs during the SAX events generation
      • createElementIfNotNull

        public static void createElementIfNotNull​(ContentHandler contentHandler,
                                                  String localName,
                                                  String stringValue,
                                                  Attributes attributes)
                                           throws SAXException
        Create a start and endElement with a empty Namespace and without Attributes If the string value is null, the element is not created
        Parameters:
        contentHandler - the ContentHandler that will receive the SAX events
        localName - The local name (without prefix)
        stringValue - The content of the Element
        attributes - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
        Throws:
        SAXException - if an error occurs during the SAX events generation
      • toString

        public String toString​(InputStream is)
        Get a XML as a string and extract the text only
        Parameters:
        is - The inputstream of XML
        Returns:
        The text or null if the XML is not well formed