Class SAXUtils


  • public class SAXUtils
    extends Object
    XML utility methods.
    • Field Detail

      • EMPTY_ATTRIBUTES

        public static final Attributes EMPTY_ATTRIBUTES
        Empty attributes immutable object.
    • Constructor Detail

      • SAXUtils

        public SAXUtils()
    • Method Detail

      • createElement

        public static void createElement​(ContentHandler contentHandler,
                                         String localName,
                                         String stringValue)
                                  throws SAXException
        Create a start and endElement with a empty Namespace and without Attributes The content of the Element is set to the stringValue parameter
        Parameters:
        localName - The local name (without prefix)
        stringValue - The content of the Element
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        See Also:
        endElement(ContentHandler, String)
      • createElement

        public static void createElement​(ContentHandler contentHandler,
                                         String localName,
                                         Attributes atts)
                                  throws SAXException
        Create a start and endElement with a empty Namespace
        Parameters:
        localName - The local name (without prefix)
        atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        See Also:
        endElement(ContentHandler, String), Attributes
      • createElement

        public static void createElement​(ContentHandler contentHandler,
                                         String localName,
                                         Attributes atts,
                                         String stringValue)
                                  throws SAXException
        Create a start and endElement with a empty Namespace The content of the Element is set to the stringValue parameter
        Parameters:
        localName - The local name (without prefix)
        atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
        stringValue - The content of the Element
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        See Also:
        endElement(ContentHandler, String), Attributes
      • createElementNS

        public static void createElementNS​(ContentHandler contentHandler,
                                           String namespaceURI,
                                           String localName,
                                           String stringValue)
                                    throws SAXException
        Create a start and endElement without Attributes The content of the Element is set to the stringValue parameter
        Parameters:
        localName - The local name (without prefix)
        stringValue - The content of the Element
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        See Also:
        endElement(ContentHandler, String)
      • createElementNS

        public static void createElementNS​(ContentHandler contentHandler,
                                           String namespaceURI,
                                           String localName,
                                           Attributes atts,
                                           String stringValue)
                                    throws SAXException
        Create a start and endElement with a empty Namespace The content of the Element is set to the stringValue parameter
        Parameters:
        localName - The local name (without prefix)
        atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
        stringValue - The content of the Element
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        See Also:
        endElement(ContentHandler, String), Attributes
      • endElement

        public static void endElement​(ContentHandler contentHandler,
                                      String localName)
                               throws SAXException
        Create endElement with empty Namespace

        For information on the names, see startElement.

        Parameters:
        localName - The local name (without prefix)
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
      • endElement

        public static void endElement​(ContentHandler contentHandler,
                                      String namespaceURI,
                                      String localName)
                               throws SAXException
        Create endElement Prefix must be mapped to empty String

        For information on the names, see startElement.

        Parameters:
        localName - The local name (without prefix)
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
      • startElement

        public static void startElement​(ContentHandler contentHandler,
                                        String namespaceURI,
                                        String localName)
                                 throws SAXException
        Create a startElement without Attributes Prefix must be mapped to empty String
        Parameters:
        namespaceURI - The Namespace URI
        localName - The local name (without prefix)
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        See Also:
        endElement(ContentHandler, String)
      • startElement

        public static void startElement​(ContentHandler contentHandler,
                                        String localName,
                                        Attributes atts)
                                 throws SAXException
        Create a startElement with a empty Namespace
        Parameters:
        localName - The local name (without prefix)
        atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        See Also:
        endElement(ContentHandler, String), Attributes
      • startElement

        public static void startElement​(ContentHandler contentHandler,
                                        String namespaceURI,
                                        String localName,
                                        Attributes atts)
                                 throws SAXException
        Create a startElement with a empty Namespace Prefix must be mapped to empty String
        Parameters:
        namespaceURI - The Namespace URI
        localName - The local name (without prefix)
        atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        See Also:
        endElement(ContentHandler, String), Attributes