Class XmlStreamReaderUtils


  • public class XmlStreamReaderUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void closeEmptyTag​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)  
      static void closeQuietly​(javax.xml.stream.XMLStreamReader reader)
      Closes an XMLStreamReader.
      static void copyStartElement​(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer)  
      static void copyText​(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer, java.lang.StringBuilder textBuilder, int flags)  
      static void copyXMLStream​(byte[] buf, int offset, int size, javax.xml.stream.XMLStreamWriter writer, int copyFlags)  
      static void copyXMLStream​(java.io.InputStream is, javax.xml.stream.XMLStreamWriter writer, int flags)  
      static void copyXMLStream​(java.io.Reader reader, javax.xml.stream.XMLStreamWriter writer, int flags)  
      static void copyXMLStream​(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer, int flags)  
      static void copyXMLStream​(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer, java.lang.StringBuilder textBuilder, int flags, boolean indentParentElementText, java.lang.String parentElement)
      Copy the XML input stream to the XML Writer as well as to a StringBuilder.
      static javax.xml.stream.XMLStreamException createXMLStreamException​(java.lang.String message, javax.xml.stream.XMLStreamReader reader, java.lang.Throwable cause)
      Returns new instance of XMLStreamException with given cause
      static javax.xml.stream.XMLStreamException createXMLStreamException​(java.lang.Throwable cause)  
      static java.lang.String getEventTypeDescription​(javax.xml.stream.XMLStreamReader reader)
      Returns string describing the current event.
      static boolean isStartElement​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Method isStartElement.
      static boolean nameEquals​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Method nameEquals.
      static boolean optionalBooleanAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, boolean defaultValue)
      Returns the value of an attribute as a boolean.
      static boolean optionalBooleanAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName, boolean defaultValue)
      Returns the value of an attribute as a boolean.
      static byte optionalByteAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, byte defaultValue)
      Returns the value of an attribute as a byte.
      static byte optionalByteAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName, byte defaultValue)
      Returns the value of an attribute as a byte.
      static java.lang.Class optionalClassAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, java.lang.Class defaultValue)
      Returns the value of an attribute as a Class.
      static java.lang.Class optionalClassAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName, java.lang.Class defaultValue)
      Returns the value of an attribute as a Class.
      static double optionalDoubleAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, double defaultValue)
      Returns the value of an attribute as a double.
      static double optionalDoubleAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName, double defaultValue)
      Returns the value of an attribute as a double.
      static float optionalFloatAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, float defaultValue)
      Returns the value of an attribute as a float.
      static float optionalFloatAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName, float defaultValue)
      Returns the value of an attribute as a float.
      static int optionalIntAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, int defaultValue)
      Returns the value of an attribute as a int.
      static int optionalIntAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName, int defaultValue)
      Returns the value of an attribute as a int.
      static long optionalLongAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, long defaultValue)
      Returns the value of an attribute as a long.
      static long optionalLongAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName, long defaultValue)
      Returns the value of an attribute as a long.
      static short optionalShortAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, short defaultValue)
      Returns the value of an attribute as a short.
      static short optionalShortAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName, short defaultValue)
      Returns the value of an attribute as a short.
      static java.lang.String optionalStringAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, java.lang.String defaultValue)
      Returns the value of an attribute as a String.
      static java.lang.String optionalStringAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName, java.lang.String defaultValue)
      Returns the value of an attribute as a String.
      static void readKeyValuePairs​(javax.xml.stream.XMLStreamReader reader, java.util.Map<java.lang.String,​java.lang.String> map)  
      static boolean requiredBooleanAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
      Returns the value of an attribute as a boolean.
      static boolean requiredBooleanAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Returns the value of an attribute as a boolean.
      static byte requiredByteAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
      Returns the value of an attribute as a byte.
      static byte requiredByteAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Returns the value of an attribute as a byte.
      static java.lang.Class requiredClassAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
      Returns the value of an attribute as a Class.
      static java.lang.Class requiredClassAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Returns the value of an attribute as a Class.
      static double requiredDoubleAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
      Returns the value of an attribute as a double.
      static double requiredDoubleAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Returns the value of an attribute as a double.
      static float requiredFloatAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
      Returns the value of an attribute as a float.
      static float requiredFloatAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Returns the value of an attribute as a float.
      static int requiredIntAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
      Returns the value of an attribute as a int.
      static int requiredIntAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Returns the value of an attribute as a int.
      static long requiredLongAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
      Returns the value of an attribute as a long.
      static long requiredLongAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Returns the value of an attribute as a long.
      static short requiredShortAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
      Returns the value of an attribute as a short.
      static short requiredShortAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Returns the value of an attribute as a short.
      static java.lang.String requiredStringAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
      Returns the value of an attribute as a String.
      static java.lang.String requiredStringAttribute​(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)
      Returns the value of an attribute as a String.
      static void requireEndDocument​(javax.xml.stream.XMLStreamReader reader)  
      static void skipElement​(javax.xml.stream.XMLStreamReader reader)
      Method skipElement.
      static void skipToMatchingEndElement​(javax.xml.stream.XMLStreamReader reader)  
      static void skipWhitespace​(javax.xml.stream.XMLStreamReader reader)  
      static javax.xml.stream.XMLStreamException wrapException​(javax.xml.stream.XMLStreamException e)  
      • Methods inherited from class java.lang.Object

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

      • COPY_START_DOCUMENT

        public static final int COPY_START_DOCUMENT
        Copy the START_DOCUMENT event.
        See Also:
        Constant Field Values
      • COPY_END_DOCUMENT

        public static final int COPY_END_DOCUMENT
        Copy the END_DOCUMENT event.
        See Also:
        Constant Field Values
      • COPY_COMMENTS

        public static final int COPY_COMMENTS
        Copy COMMENT events.
        See Also:
        Constant Field Values
      • COPY_IGNORABLE_WHITESPACE

        public static final int COPY_IGNORABLE_WHITESPACE
        Copy SPACE events.
        See Also:
        Constant Field Values
      • COPY_SINGLE_ELEMENT

        public static final int COPY_SINGLE_ELEMENT
        Stop copying after an END_ELEMENT event matching the current START_ELEMENT event is copied.
        See Also:
        Constant Field Values
      • DEFAULT_COPY_FLAGS

        public static final int DEFAULT_COPY_FLAGS
        Default copy flags
        See Also:
        Constant Field Values
    • Method Detail

      • closeEmptyTag

        public static void closeEmptyTag​(javax.xml.stream.XMLStreamReader reader,
                                         java.lang.String namespace,
                                         java.lang.String localName)
                                  throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • closeQuietly

        public static void closeQuietly​(javax.xml.stream.XMLStreamReader reader)
        Closes an XMLStreamReader.

        This method will quietly log any IOException that may occur but will otherwise ignore it.

        Parameters:
        reader - XMLStreamReader to be closed.
      • copyStartElement

        public static void copyStartElement​(javax.xml.stream.XMLStreamReader reader,
                                            javax.xml.stream.XMLStreamWriter writer)
                                     throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • copyText

        public static void copyText​(javax.xml.stream.XMLStreamReader reader,
                                    javax.xml.stream.XMLStreamWriter writer,
                                    java.lang.StringBuilder textBuilder,
                                    int flags)
                             throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • copyXMLStream

        public static void copyXMLStream​(byte[] buf,
                                         int offset,
                                         int size,
                                         javax.xml.stream.XMLStreamWriter writer,
                                         int copyFlags)
                                  throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • copyXMLStream

        public static void copyXMLStream​(java.io.InputStream is,
                                         javax.xml.stream.XMLStreamWriter writer,
                                         int flags)
                                  throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • copyXMLStream

        public static void copyXMLStream​(java.io.Reader reader,
                                         javax.xml.stream.XMLStreamWriter writer,
                                         int flags)
                                  throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • copyXMLStream

        public static void copyXMLStream​(javax.xml.stream.XMLStreamReader reader,
                                         javax.xml.stream.XMLStreamWriter writer,
                                         int flags)
                                  throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • copyXMLStream

        public static void copyXMLStream​(javax.xml.stream.XMLStreamReader reader,
                                         javax.xml.stream.XMLStreamWriter writer,
                                         java.lang.StringBuilder textBuilder,
                                         int flags,
                                         boolean indentParentElementText,
                                         java.lang.String parentElement)
                                  throws javax.xml.stream.XMLStreamException
        Copy the XML input stream to the XML Writer as well as to a StringBuilder.
        Parameters:
        reader - the XMLStreamReader
        writer - the XMLStreamWriter
        textBuilder - the StringBuilder
        flags - the flags indicating copying options
        indentParentElementText - a boolean flag indicating if what to indent before the parent element when copying to the StringBuilder
        parentElement - the parent element
        Throws:
        javax.xml.stream.XMLStreamException - if there is error processing stream
      • createXMLStreamException

        public static javax.xml.stream.XMLStreamException createXMLStreamException​(java.lang.String message,
                                                                                   javax.xml.stream.XMLStreamReader reader,
                                                                                   java.lang.Throwable cause)
        Returns new instance of XMLStreamException with given cause
        Parameters:
        message - exception message
        reader - parser
        cause - underlying cause
        Returns:
        XMLStreamException with given cause
      • createXMLStreamException

        public static javax.xml.stream.XMLStreamException createXMLStreamException​(java.lang.Throwable cause)
      • getEventTypeDescription

        public static java.lang.String getEventTypeDescription​(javax.xml.stream.XMLStreamReader reader)
        Returns string describing the current event.
        Parameters:
        reader - pull parser that contains event information
        Returns:
        string describing the current event.
      • isStartElement

        public static boolean isStartElement​(javax.xml.stream.XMLStreamReader reader,
                                             java.lang.String namespace,
                                             java.lang.String localName)
        Method isStartElement.
        Parameters:
        reader - XMLStreamReader
        namespace - String
        localName - String
        Returns:
        boolean
      • nameEquals

        public static boolean nameEquals​(javax.xml.stream.XMLStreamReader reader,
                                         java.lang.String namespace,
                                         java.lang.String localName)
        Method nameEquals.
        Parameters:
        reader - XMLStreamReader
        namespace - String
        localName - String
        Returns:
        boolean
      • optionalBooleanAttribute

        public static boolean optionalBooleanAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                       java.lang.String localName,
                                                       boolean defaultValue)
        Returns the value of an attribute as a boolean. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalBooleanAttribute

        public static boolean optionalBooleanAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                       java.lang.String namespace,
                                                       java.lang.String localName,
                                                       boolean defaultValue)
        Returns the value of an attribute as a boolean. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - String
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalByteAttribute

        public static byte optionalByteAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                 java.lang.String localName,
                                                 byte defaultValue)
        Returns the value of an attribute as a byte. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalByteAttribute

        public static byte optionalByteAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                 java.lang.String namespace,
                                                 java.lang.String localName,
                                                 byte defaultValue)
        Returns the value of an attribute as a byte. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - String
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalClassAttribute

        public static java.lang.Class optionalClassAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                             java.lang.String localName,
                                                             java.lang.Class defaultValue)
                                                      throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a Class. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
        Throws:
        javax.xml.stream.XMLStreamException - if there is error processing stream
      • optionalClassAttribute

        public static java.lang.Class optionalClassAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                             java.lang.String namespace,
                                                             java.lang.String localName,
                                                             java.lang.Class defaultValue)
                                                      throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a Class. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - String
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
        Throws:
        javax.xml.stream.XMLStreamException - if there is error processing stream
      • optionalDoubleAttribute

        public static double optionalDoubleAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                     java.lang.String localName,
                                                     double defaultValue)
        Returns the value of an attribute as a double. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalDoubleAttribute

        public static double optionalDoubleAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                     java.lang.String namespace,
                                                     java.lang.String localName,
                                                     double defaultValue)
        Returns the value of an attribute as a double. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - String
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalFloatAttribute

        public static float optionalFloatAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                   java.lang.String localName,
                                                   float defaultValue)
        Returns the value of an attribute as a float. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalFloatAttribute

        public static float optionalFloatAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                   java.lang.String namespace,
                                                   java.lang.String localName,
                                                   float defaultValue)
        Returns the value of an attribute as a float. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - String
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalIntAttribute

        public static int optionalIntAttribute​(javax.xml.stream.XMLStreamReader reader,
                                               java.lang.String localName,
                                               int defaultValue)
        Returns the value of an attribute as a int. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalIntAttribute

        public static int optionalIntAttribute​(javax.xml.stream.XMLStreamReader reader,
                                               java.lang.String namespace,
                                               java.lang.String localName,
                                               int defaultValue)
        Returns the value of an attribute as a int. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - String
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalLongAttribute

        public static long optionalLongAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                 java.lang.String localName,
                                                 long defaultValue)
        Returns the value of an attribute as a long. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalLongAttribute

        public static long optionalLongAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                 java.lang.String namespace,
                                                 java.lang.String localName,
                                                 long defaultValue)
        Returns the value of an attribute as a long. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - String
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalShortAttribute

        public static short optionalShortAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                   java.lang.String localName,
                                                   short defaultValue)
        Returns the value of an attribute as a short. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalShortAttribute

        public static short optionalShortAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                   java.lang.String namespace,
                                                   java.lang.String localName,
                                                   short defaultValue)
        Returns the value of an attribute as a short. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - String
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalStringAttribute

        public static java.lang.String optionalStringAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                               java.lang.String localName,
                                                               java.lang.String defaultValue)
        Returns the value of an attribute as a String. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • optionalStringAttribute

        public static java.lang.String optionalStringAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                               java.lang.String namespace,
                                                               java.lang.String localName,
                                                               java.lang.String defaultValue)
        Returns the value of an attribute as a String. If the attribute is empty, this method returns the default value provided.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - String
        localName - local name of attribute (the namespace is ignored).
        defaultValue - default value
        Returns:
        value of attribute, or the default value if the attribute is empty.
      • readKeyValuePairs

        public static void readKeyValuePairs​(javax.xml.stream.XMLStreamReader reader,
                                             java.util.Map<java.lang.String,​java.lang.String> map)
                                      throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • requiredBooleanAttribute

        public static boolean requiredBooleanAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                       java.lang.String localName)
                                                throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a boolean. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        Returns:
        value of attribute as boolean
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredBooleanAttribute

        public static boolean requiredBooleanAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                       java.lang.String namespace,
                                                       java.lang.String localName)
                                                throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a boolean. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - namespace
        localName - the local name of the attribute.
        Returns:
        value of attribute as boolean
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredByteAttribute

        public static byte requiredByteAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                 java.lang.String localName)
                                          throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a byte. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        Returns:
        value of attribute as byte
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredByteAttribute

        public static byte requiredByteAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                 java.lang.String namespace,
                                                 java.lang.String localName)
                                          throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a byte. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - namespace
        localName - the local name of the attribute.
        Returns:
        value of attribute as byte
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredClassAttribute

        public static java.lang.Class requiredClassAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                             java.lang.String localName)
                                                      throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a Class. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        Returns:
        value of attribute as Class
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredClassAttribute

        public static java.lang.Class requiredClassAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                             java.lang.String namespace,
                                                             java.lang.String localName)
                                                      throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a Class. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - namespace
        localName - the local name of the attribute.
        Returns:
        value of attribute as Class
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredDoubleAttribute

        public static double requiredDoubleAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                     java.lang.String localName)
                                              throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a double. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        Returns:
        value of attribute as double
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredDoubleAttribute

        public static double requiredDoubleAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                     java.lang.String namespace,
                                                     java.lang.String localName)
                                              throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a double. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - namespace
        localName - the local name of the attribute.
        Returns:
        value of attribute as double
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredFloatAttribute

        public static float requiredFloatAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                   java.lang.String localName)
                                            throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a float. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        Returns:
        value of attribute as float
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredFloatAttribute

        public static float requiredFloatAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                   java.lang.String namespace,
                                                   java.lang.String localName)
                                            throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a float. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - namespace
        localName - the local name of the attribute.
        Returns:
        value of attribute as float
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredIntAttribute

        public static int requiredIntAttribute​(javax.xml.stream.XMLStreamReader reader,
                                               java.lang.String localName)
                                        throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a int. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        Returns:
        value of attribute as int
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredIntAttribute

        public static int requiredIntAttribute​(javax.xml.stream.XMLStreamReader reader,
                                               java.lang.String namespace,
                                               java.lang.String localName)
                                        throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a int. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - namespace
        localName - the local name of the attribute.
        Returns:
        value of attribute as int
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredLongAttribute

        public static long requiredLongAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                 java.lang.String localName)
                                          throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a long. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        Returns:
        value of attribute as long
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredLongAttribute

        public static long requiredLongAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                 java.lang.String namespace,
                                                 java.lang.String localName)
                                          throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a long. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - namespace
        localName - the local name of the attribute.
        Returns:
        value of attribute as long
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredShortAttribute

        public static short requiredShortAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                   java.lang.String localName)
                                            throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a short. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        Returns:
        value of attribute as short
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredShortAttribute

        public static short requiredShortAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                   java.lang.String namespace,
                                                   java.lang.String localName)
                                            throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a short. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - namespace
        localName - the local name of the attribute.
        Returns:
        value of attribute as short
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredStringAttribute

        public static java.lang.String requiredStringAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                               java.lang.String localName)
                                                        throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a String. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        localName - local name of attribute (the namespace is ignored).
        Returns:
        value of attribute as String
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requiredStringAttribute

        public static java.lang.String requiredStringAttribute​(javax.xml.stream.XMLStreamReader reader,
                                                               java.lang.String namespace,
                                                               java.lang.String localName)
                                                        throws javax.xml.stream.XMLStreamException
        Returns the value of an attribute as a String. If the attribute is empty, this method throws an exception.
        Parameters:
        reader - XMLStreamReader that contains attribute values.
        namespace - namespace
        localName - the local name of the attribute.
        Returns:
        value of attribute as String
        Throws:
        javax.xml.stream.XMLStreamException - if attribute is empty.
      • requireEndDocument

        public static final void requireEndDocument​(javax.xml.stream.XMLStreamReader reader)
                                             throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • skipElement

        public static void skipElement​(javax.xml.stream.XMLStreamReader reader)
                                throws javax.xml.stream.XMLStreamException,
                                       java.io.IOException
        Method skipElement.
        Parameters:
        reader - XMLStreamReader
        Throws:
        javax.xml.stream.XMLStreamException - if there is error skipping element
        java.io.IOException - if there is error skipping element
      • skipToMatchingEndElement

        public static void skipToMatchingEndElement​(javax.xml.stream.XMLStreamReader reader)
                                             throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • skipWhitespace

        public static final void skipWhitespace​(javax.xml.stream.XMLStreamReader reader)
                                         throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • wrapException

        public static final javax.xml.stream.XMLStreamException wrapException​(javax.xml.stream.XMLStreamException e)