public final class ParseUtils extends Object
Modifier and Type | Method and Description |
---|---|
static XMLStreamException |
duplicateAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader,
String name)
Get an exception reporting that an attribute of a given name has already
been declared in this scope.
|
static XMLStreamException |
duplicateNamedElement(org.jboss.staxmapper.XMLExtendedStreamReader 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 |
getWarningMessage(String msg,
Location location) |
static XMLStreamException |
invalidAttributeValue(org.jboss.staxmapper.XMLExtendedStreamReader reader,
int index)
Get an exception reporting an invalid XML attribute value.
|
static boolean |
isNoNamespaceAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader,
int index) |
static XMLStreamException |
missingOneOf(org.jboss.staxmapper.XMLExtendedStreamReader reader,
Set<?> required)
Get an exception reporting a missing, required XML child element.
|
static XMLStreamException |
missingRequired(org.jboss.staxmapper.XMLExtendedStreamReader reader,
Set<?> required)
Get an exception reporting a missing, required XML attribute.
|
static XMLStreamException |
missingRequiredElement(org.jboss.staxmapper.XMLExtendedStreamReader reader,
Set<?> required)
Get an exception reporting a missing, required XML child element.
|
static Element |
nextElement(org.jboss.staxmapper.XMLExtendedStreamReader reader) |
static Element |
nextElement(org.jboss.staxmapper.XMLExtendedStreamReader reader,
Namespace expectedNamespace)
A variation of nextElement that verifies the nextElement is not in a different namespace.
|
static org.jboss.dmr.ModelNode |
parseBoundedIntegerAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader,
int index,
int minInclusive,
int maxInclusive,
boolean allowExpression) |
static org.jboss.dmr.ModelNode |
parsePossibleExpression(String value) |
static <T> T[] |
readArrayAttributeElement(org.jboss.staxmapper.XMLExtendedStreamReader reader,
String attributeName,
Class<T> type)
Read an element which contains only a single list attribute of a given
type, returning it as an array.
|
static boolean |
readBooleanAttributeElement(org.jboss.staxmapper.XMLExtendedStreamReader reader,
String attributeName)
Read an element which contains only a single boolean attribute.
|
static <T> List<T> |
readListAttributeElement(org.jboss.staxmapper.XMLExtendedStreamReader reader,
String attributeName,
Class<T> type)
Read an element which contains only a single list attribute of a given
type.
|
static org.jboss.dmr.Property |
readProperty(org.jboss.staxmapper.XMLExtendedStreamReader reader) |
static String |
readStringAttributeElement(org.jboss.staxmapper.XMLExtendedStreamReader reader,
String attributeName)
Read an element which contains only a single string attribute.
|
static String[] |
requireAttributes(org.jboss.staxmapper.XMLExtendedStreamReader reader,
String... attributeNames)
Require all the named attributes, returning their values in order.
|
static void |
requireNamespace(org.jboss.staxmapper.XMLExtendedStreamReader reader,
Namespace requiredNs)
Require that the namespace of the current element matches the required namespace.
|
static void |
requireNoAttributes(org.jboss.staxmapper.XMLExtendedStreamReader reader)
Checks that the current element has no attributes, throwing an
XMLStreamException if one is found. |
static void |
requireNoContent(org.jboss.staxmapper.XMLExtendedStreamReader reader)
Consumes the remainder of the current element, throwing an
XMLStreamException if it contains any child
elements. |
static void |
requireNoNamespaceAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader,
int index) |
static void |
requireSingleAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader,
String attributeName)
Require that the current element have only a single attribute with the
given name.
|
static XMLStreamException |
unexpectedAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader,
int index)
Get an exception reporting an unexpected XML attribute.
|
static XMLStreamException |
unexpectedElement(org.jboss.staxmapper.XMLExtendedStreamReader reader)
Get an exception reporting an unexpected XML element.
|
static XMLStreamException |
unexpectedEndElement(org.jboss.staxmapper.XMLExtendedStreamReader reader)
Get an exception reporting an unexpected end tag for an XML element.
|
public static Element nextElement(org.jboss.staxmapper.XMLExtendedStreamReader reader) throws XMLStreamException
XMLStreamException
public static Element nextElement(org.jboss.staxmapper.XMLExtendedStreamReader reader, Namespace expectedNamespace) throws XMLStreamException
reader
- the XmlExtendedReader to read from.expectedNamespace
- the namespace expected.XMLStreamException
- if the namespace is wrong or there is a problem accessing the readerpublic static XMLStreamException unexpectedElement(org.jboss.staxmapper.XMLExtendedStreamReader reader)
reader
- the stream readerpublic static XMLStreamException unexpectedEndElement(org.jboss.staxmapper.XMLExtendedStreamReader reader)
reader
- the stream readerpublic static XMLStreamException unexpectedAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader, int index)
reader
- the stream readerindex
- the attribute indexpublic static XMLStreamException invalidAttributeValue(org.jboss.staxmapper.XMLExtendedStreamReader reader, int index)
reader
- the stream readerindex
- the attribute indexpublic static XMLStreamException missingRequired(org.jboss.staxmapper.XMLExtendedStreamReader reader, Set<?> required)
reader
- the stream readerrequired
- a set of enums whose toString method returns the
attribute namepublic static XMLStreamException missingRequiredElement(org.jboss.staxmapper.XMLExtendedStreamReader reader, Set<?> required)
reader
- the stream readerrequired
- a set of enums whose toString method returns the
attribute namepublic static XMLStreamException missingOneOf(org.jboss.staxmapper.XMLExtendedStreamReader reader, Set<?> required)
reader
- the stream readerrequired
- a set of enums whose toString method returns the
attribute namepublic static void requireNoAttributes(org.jboss.staxmapper.XMLExtendedStreamReader reader) throws XMLStreamException
XMLStreamException
if one is found.reader
- the readerXMLStreamException
- if an error occurspublic static void requireNoContent(org.jboss.staxmapper.XMLExtendedStreamReader reader) throws XMLStreamException
XMLStreamException
if it contains any child
elements.reader
- the readerXMLStreamException
- if an error occurspublic static void requireNamespace(org.jboss.staxmapper.XMLExtendedStreamReader reader, Namespace requiredNs) throws XMLStreamException
reader
- the readerrequiredNs
- the namespace requiredXMLStreamException
- if the current namespace does not match the required namespacepublic static XMLStreamException duplicateAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader, String name)
reader
- the stream readername
- the name that was redeclaredpublic static XMLStreamException duplicateNamedElement(org.jboss.staxmapper.XMLExtendedStreamReader reader, String name)
reader
- the stream readername
- the name that was redeclaredpublic static boolean readBooleanAttributeElement(org.jboss.staxmapper.XMLExtendedStreamReader 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(org.jboss.staxmapper.XMLExtendedStreamReader 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 <T> List<T> readListAttributeElement(org.jboss.staxmapper.XMLExtendedStreamReader reader, String attributeName, Class<T> type) throws XMLStreamException
T
- the value typereader
- the readerattributeName
- the attribute name, usually "value"type
- the value type classXMLStreamException
- if an error occurs or if the
element does not contain the specified attribute, contains other
attributes, or contains child elements.public static org.jboss.dmr.Property readProperty(org.jboss.staxmapper.XMLExtendedStreamReader reader) throws XMLStreamException
XMLStreamException
public static <T> T[] readArrayAttributeElement(org.jboss.staxmapper.XMLExtendedStreamReader reader, String attributeName, Class<T> type) throws XMLStreamException
T
- the value typereader
- the readerattributeName
- the attribute name, usually "value"type
- the value type classXMLStreamException
- if an error occurs or if the
element does not contain the specified attribute, contains other
attributes, or contains child elements.public static void requireSingleAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader, String attributeName) throws XMLStreamException
reader
- the readerattributeName
- the attribute nameXMLStreamException
- if an error occurspublic static String[] requireAttributes(org.jboss.staxmapper.XMLExtendedStreamReader reader, String... attributeNames) throws XMLStreamException
reader
- the readerattributeNames
- the attribute namesXMLStreamException
- if an error occurspublic static boolean isNoNamespaceAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader, int index)
public static void requireNoNamespaceAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader, int index) throws XMLStreamException
XMLStreamException
public static org.jboss.dmr.ModelNode parseBoundedIntegerAttribute(org.jboss.staxmapper.XMLExtendedStreamReader reader, int index, int minInclusive, int maxInclusive, boolean allowExpression) throws XMLStreamException
XMLStreamException
public static org.jboss.dmr.ModelNode parsePossibleExpression(String value)
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All rights reserved.