Class SaxHelper


  • public final class SaxHelper
    extends Object
    Helper methods for SAX handlers.
    • Method Detail

      • getBooleanAttribute

        public static Boolean getBooleanAttribute​(String attributeName,
                                                  Attributes attributes,
                                                  String elementDescription)
                                           throws SAXException
        Retrieves an attribute as boolean value.
        Parameters:
        attributeName - the name of the attribute to retrieve, not null.
        attributes - The attributes of the current element.
        elementDescription - the description of the parsed element, for producing a user-readable error message. E.g "the optionAction ${nameOfTheAction}"
        Returns:
        the value of the attribute, or null if the attribute is not set.
        Throws:
        SAXException - if the attribute contains content other than "true", "1" , "false" or "0".
      • getUnqualifiedName

        public static String getUnqualifiedName​(String localName,
                                                String qName)
        Retrieves the unqualified part of an XML element name name, regardless whether namespace processing is switched on or off.
        Parameters:
        localName - The local name (without prefix), or the empty string if namespace processing is not being performed.
        qName - The qualified name (with prefix), or the empty string if qualified names are not available.
        Returns:
        the unqualified part of the name.