public final class ParseUtils extends Object
Modifier and Type | Method and Description |
---|---|
static XMLStreamException |
duplicateAttribute(XMLStreamReader reader,
String name)
Get an exception reporting that an attribute of a given name has already
been declared in this scope.
|
static XMLStreamException |
duplicateNamedElement(XMLStreamReader reader,
String name)
Get an exception reporting that an element of a given type and name has
already been declared in this scope.
|
static String[] |
getListAttributeValue(String value) |
static Namespace[] |
getNamespaceAnnotations(Class<?> cls) |
static XMLStreamException |
invalidAttributeValue(XMLStreamReader reader,
int index)
Get an exception reporting an invalid XML attribute value.
|
static boolean |
isNoNamespaceAttribute(XMLStreamReader reader,
int index) |
static XMLStreamException |
missingRequired(XMLStreamReader reader,
Set<?> required)
Get an exception reporting a missing, required XML attribute.
|
static XMLStreamException |
missingRequiredElement(XMLStreamReader reader,
Set<?> required)
Get an exception reporting a missing, required XML child element.
|
static Element |
nextElement(XMLStreamReader reader) |
static boolean |
readBooleanAttributeElement(XMLStreamReader reader,
String attributeName)
Read an element which contains only a single boolean attribute.
|
static String |
readStringAttributeElement(XMLStreamReader reader,
String attributeName)
Read an element which contains only a single string attribute.
|
static String |
requireAttributeProperty(XMLStreamReader reader,
int i) |
static String[] |
requireAttributes(XMLStreamReader reader,
boolean replace,
String... attributeNames)
Require all the named attributes, returning their values in order.
|
static String[] |
requireAttributes(XMLStreamReader reader,
Enum<?>... attributes) |
static String[] |
requireAttributes(XMLStreamReader reader,
String... attributeNames) |
static void |
requireNoAttributes(XMLStreamReader reader)
Checks that the current element has no attributes, throwing an
XMLStreamException if one is found. |
static void |
requireNoContent(XMLStreamReader reader)
Consumes the remainder of the current element, throwing an
XMLStreamException if it contains any child
elements. |
static void |
requireNoNamespaceAttribute(XMLStreamReader reader,
int index) |
static String |
requireSingleAttribute(XMLStreamReader reader,
Enum<?> attribute) |
static String |
requireSingleAttribute(XMLStreamReader reader,
String attributeName)
Require that the current element have only a single attribute with the
given name.
|
static String |
resolvePath(String path,
String relativeTo) |
static XMLStreamException |
unexpectedAttribute(XMLStreamReader reader,
int index)
Get an exception reporting an unexpected XML attribute.
|
static XMLStreamException |
unexpectedAttribute(XMLStreamReader reader,
String name)
Get an exception reporting an unexpected XML attribute.
|
static XMLStreamException |
unexpectedElement(XMLStreamReader reader)
Get an exception reporting an unexpected XML element.
|
static <T extends Enum<T>> |
unexpectedElement(XMLStreamReader reader,
T element) |
static XMLStreamException |
unexpectedEndElement(XMLStreamReader reader)
Get an exception reporting an unexpected end tag for an XML element.
|
public static Element nextElement(XMLStreamReader reader) throws XMLStreamException
XMLStreamException
public static XMLStreamException unexpectedElement(XMLStreamReader reader)
reader
- the stream readerpublic static <T extends Enum<T>> XMLStreamException unexpectedElement(XMLStreamReader reader, T element)
public static XMLStreamException unexpectedEndElement(XMLStreamReader reader)
reader
- the stream readerpublic static XMLStreamException unexpectedAttribute(XMLStreamReader reader, int index)
reader
- the stream readerindex
- the attribute indexpublic static XMLStreamException unexpectedAttribute(XMLStreamReader reader, String name)
reader
- the stream readername
- the attribute namepublic static XMLStreamException invalidAttributeValue(XMLStreamReader reader, int index)
reader
- the stream readerindex
- the attribute indexpublic static XMLStreamException missingRequired(XMLStreamReader reader, Set<?> required)
reader
- the stream readerrequired
- a set of enums whose toString method returns the
attribute namepublic static XMLStreamException missingRequiredElement(XMLStreamReader reader, Set<?> required)
reader
- the stream readerrequired
- a set of enums whose toString method returns the
attribute namepublic static void requireNoAttributes(XMLStreamReader reader) throws XMLStreamException
XMLStreamException
if one is found.reader
- the readerXMLStreamException
- if an error occurspublic static void requireNoContent(XMLStreamReader reader) throws XMLStreamException
XMLStreamException
if it contains any child
elements.reader
- the readerXMLStreamException
- if an error occurspublic static XMLStreamException duplicateAttribute(XMLStreamReader reader, String name)
reader
- the stream readername
- the name that was redeclaredpublic static XMLStreamException duplicateNamedElement(XMLStreamReader reader, String name)
reader
- the stream readername
- the name that was redeclaredpublic static boolean readBooleanAttributeElement(XMLStreamReader reader, String attributeName) throws XMLStreamException
reader
- the readerattributeName
- the attribute name, usually "value"XMLStreamException
- if an error occurs or if the
element does not contain the specified attribute, contains other
attributes, or contains child elements.public static String readStringAttributeElement(XMLStreamReader reader, String attributeName) throws XMLStreamException
reader
- the readerattributeName
- the attribute name, usually "value" or "name"XMLStreamException
- if an error occurs or if the
element does not contain the specified attribute, contains other
attributes, or contains child elements.public static String requireSingleAttribute(XMLStreamReader reader, String attributeName) throws XMLStreamException
reader
- the readerattributeName
- the attribute nameXMLStreamException
- if an error occurspublic static String requireSingleAttribute(XMLStreamReader reader, Enum<?> attribute) throws XMLStreamException
XMLStreamException
public static String[] requireAttributes(XMLStreamReader reader, boolean replace, String... attributeNames) throws XMLStreamException
reader
- the readerattributeNames
- the attribute namesXMLStreamException
- if an error occurspublic static String[] requireAttributes(XMLStreamReader reader, String... attributeNames) throws XMLStreamException
XMLStreamException
public static String[] requireAttributes(XMLStreamReader reader, Enum<?>... attributes) throws XMLStreamException
XMLStreamException
public static boolean isNoNamespaceAttribute(XMLStreamReader reader, int index)
public static void requireNoNamespaceAttribute(XMLStreamReader reader, int index) throws XMLStreamException
XMLStreamException
public static String requireAttributeProperty(XMLStreamReader reader, int i) throws XMLStreamException
XMLStreamException
Copyright © 2021 JBoss by Red Hat. All rights reserved.