Package com.arakelian.core.utils
Class XmlStreamReaderUtils
- java.lang.Object
-
- com.arakelian.core.utils.XmlStreamReaderUtils
-
public class XmlStreamReaderUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static intCOPY_COMMENTSCopy COMMENT events.static intCOPY_END_DOCUMENTCopy the END_DOCUMENT event.static intCOPY_IGNORABLE_WHITESPACECopy SPACE events.static intCOPY_SINGLE_ELEMENTStop copying after an END_ELEMENT event matching the current START_ELEMENT event is copied.static intCOPY_START_DOCUMENTCopy the START_DOCUMENT event.static intDEFAULT_COPY_FLAGSDefault copy flags
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseEmptyTag(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)static voidcloseQuietly(javax.xml.stream.XMLStreamReader reader)Closes anXMLStreamReader.static voidcopyStartElement(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer)static voidcopyText(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer, java.lang.StringBuilder textBuilder, int flags)static voidcopyXMLStream(byte[] buf, int offset, int size, javax.xml.stream.XMLStreamWriter writer, int copyFlags)static voidcopyXMLStream(java.io.InputStream is, javax.xml.stream.XMLStreamWriter writer, int flags)static voidcopyXMLStream(java.io.Reader reader, javax.xml.stream.XMLStreamWriter writer, int flags)static voidcopyXMLStream(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer, int flags)static voidcopyXMLStream(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.XMLStreamExceptioncreateXMLStreamException(java.lang.String message, javax.xml.stream.XMLStreamReader reader, java.lang.Throwable cause)Returns new instance ofXMLStreamExceptionwith given causestatic javax.xml.stream.XMLStreamExceptioncreateXMLStreamException(java.lang.Throwable cause)static java.lang.StringgetEventTypeDescription(javax.xml.stream.XMLStreamReader reader)Returns string describing the current event.static booleanisStartElement(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)Method isStartElement.static booleannameEquals(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)Method nameEquals.static booleanoptionalBooleanAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, boolean defaultValue)Returns the value of an attribute as a boolean.static booleanoptionalBooleanAttribute(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 byteoptionalByteAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, byte defaultValue)Returns the value of an attribute as a byte.static byteoptionalByteAttribute(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.ClassoptionalClassAttribute(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.ClassoptionalClassAttribute(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 doubleoptionalDoubleAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, double defaultValue)Returns the value of an attribute as a double.static doubleoptionalDoubleAttribute(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 floatoptionalFloatAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, float defaultValue)Returns the value of an attribute as a float.static floatoptionalFloatAttribute(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 intoptionalIntAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, int defaultValue)Returns the value of an attribute as a int.static intoptionalIntAttribute(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 longoptionalLongAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, long defaultValue)Returns the value of an attribute as a long.static longoptionalLongAttribute(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 shortoptionalShortAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName, short defaultValue)Returns the value of an attribute as a short.static shortoptionalShortAttribute(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.StringoptionalStringAttribute(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.StringoptionalStringAttribute(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 voidreadKeyValuePairs(javax.xml.stream.XMLStreamReader reader, java.util.Map<java.lang.String,java.lang.String> map)static booleanrequiredBooleanAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)Returns the value of an attribute as a boolean.static booleanrequiredBooleanAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)Returns the value of an attribute as a boolean.static byterequiredByteAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)Returns the value of an attribute as a byte.static byterequiredByteAttribute(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.ClassrequiredClassAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)Returns the value of an attribute as a Class.static java.lang.ClassrequiredClassAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)Returns the value of an attribute as a Class.static doublerequiredDoubleAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)Returns the value of an attribute as a double.static doublerequiredDoubleAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)Returns the value of an attribute as a double.static floatrequiredFloatAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)Returns the value of an attribute as a float.static floatrequiredFloatAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)Returns the value of an attribute as a float.static intrequiredIntAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)Returns the value of an attribute as a int.static intrequiredIntAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)Returns the value of an attribute as a int.static longrequiredLongAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)Returns the value of an attribute as a long.static longrequiredLongAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)Returns the value of an attribute as a long.static shortrequiredShortAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)Returns the value of an attribute as a short.static shortrequiredShortAttribute(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.StringrequiredStringAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)Returns the value of an attribute as a String.static java.lang.StringrequiredStringAttribute(javax.xml.stream.XMLStreamReader reader, java.lang.String namespace, java.lang.String localName)Returns the value of an attribute as a String.static voidrequireEndDocument(javax.xml.stream.XMLStreamReader reader)static voidskipElement(javax.xml.stream.XMLStreamReader reader)Method skipElement.static voidskipToMatchingEndElement(javax.xml.stream.XMLStreamReader reader)static voidskipWhitespace(javax.xml.stream.XMLStreamReader reader)static javax.xml.stream.XMLStreamExceptionwrapException(javax.xml.stream.XMLStreamException e)
-
-
-
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 anXMLStreamReader.This method will quietly log any
IOExceptionthat 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.XMLStreamExceptionCopy the XML input stream to the XML Writer as well as to a StringBuilder.- Parameters:
reader- the XMLStreamReaderwriter- the XMLStreamWritertextBuilder- the StringBuilderflags- the flags indicating copying optionsindentParentElementText- a boolean flag indicating if what to indent before the parent element when copying to the StringBuilderparentElement- 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 ofXMLStreamExceptionwith given cause- Parameters:
message- exception messagereader- parsercause- underlying cause- Returns:
XMLStreamExceptionwith 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- XMLStreamReadernamespace- StringlocalName- 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- XMLStreamReadernamespace- StringlocalName- 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-XMLStreamReaderthat 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-XMLStreamReaderthat contains attribute values.namespace- StringlocalName- 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-XMLStreamReaderthat 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-XMLStreamReaderthat contains attribute values.namespace- StringlocalName- 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.XMLStreamExceptionReturns the value of an attribute as a Class. If the attribute is empty, this method returns the default value provided.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a Class. If the attribute is empty, this method returns the default value provided.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- StringlocalName- 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-XMLStreamReaderthat 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-XMLStreamReaderthat contains attribute values.namespace- StringlocalName- 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-XMLStreamReaderthat 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-XMLStreamReaderthat contains attribute values.namespace- StringlocalName- 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-XMLStreamReaderthat 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-XMLStreamReaderthat contains attribute values.namespace- StringlocalName- 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-XMLStreamReaderthat 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-XMLStreamReaderthat contains attribute values.namespace- StringlocalName- 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-XMLStreamReaderthat 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-XMLStreamReaderthat contains attribute values.namespace- StringlocalName- 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-XMLStreamReaderthat 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-XMLStreamReaderthat contains attribute values.namespace- StringlocalName- 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.XMLStreamExceptionReturns the value of an attribute as a boolean. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a boolean. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- namespacelocalName- 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.XMLStreamExceptionReturns the value of an attribute as a byte. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a byte. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- namespacelocalName- 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.XMLStreamExceptionReturns the value of an attribute as a Class. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a Class. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- namespacelocalName- 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.XMLStreamExceptionReturns the value of an attribute as a double. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a double. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- namespacelocalName- 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.XMLStreamExceptionReturns the value of an attribute as a float. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a float. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- namespacelocalName- 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.XMLStreamExceptionReturns the value of an attribute as a int. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a int. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- namespacelocalName- 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.XMLStreamExceptionReturns the value of an attribute as a long. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a long. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- namespacelocalName- 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.XMLStreamExceptionReturns the value of an attribute as a short. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a short. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- namespacelocalName- 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.XMLStreamExceptionReturns the value of an attribute as a String. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat 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.XMLStreamExceptionReturns the value of an attribute as a String. If the attribute is empty, this method throws an exception.- Parameters:
reader-XMLStreamReaderthat contains attribute values.namespace- namespacelocalName- 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.IOExceptionMethod skipElement.- Parameters:
reader- XMLStreamReader- Throws:
javax.xml.stream.XMLStreamException- if there is error skipping elementjava.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)
-
-