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 |
getWarningMessage(String msg,
Location location) |
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[] |
requireAttributes(XMLStreamReader reader,
String... attributeNames)
Require all the named attributes, returning their values in order.
|
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 void |
requireSingleAttribute(XMLStreamReader reader,
String attributeName)
Require that the current element have only a single attribute with the
given name.
|
static XMLStreamException |
unexpectedAttribute(XMLStreamReader reader,
int index)
Get an exception reporting an unexpected XML attribute.
|
static XMLStreamException |
unexpectedElement(XMLStreamReader reader)
Get an exception reporting an unexpected XML 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 XMLStreamException unexpectedEndElement(XMLStreamReader reader)
reader
- the stream readerpublic static XMLStreamException unexpectedAttribute(XMLStreamReader reader, int index)
reader
- the stream readerindex
- the attribute indexpublic 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 void requireSingleAttribute(XMLStreamReader reader, String attributeName) throws XMLStreamException
reader
- the readerattributeName
- the attribute nameXMLStreamException
- if an error occurspublic static String[] requireAttributes(XMLStreamReader reader, String... attributeNames) throws XMLStreamException
reader
- the readerattributeNames
- the attribute namesXMLStreamException
- if an error occurspublic static boolean isNoNamespaceAttribute(XMLStreamReader reader, int index)
public static void requireNoNamespaceAttribute(XMLStreamReader reader, int index) throws XMLStreamException
XMLStreamException
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.