public class StaxParserUtil extends Object
| Constructor and Description | 
|---|
| StaxParserUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | bypassElementBlock(XMLEventReader xmlEventReader,
                  String tag)Bypass an entire XML element block from startElement to endElement | 
| static String | getAttributeValue(Attribute attribute)Given an  Attribute, get its trimmed value | 
| static String | getAttributeValue(Attribute attribute,
                 boolean resolveProperties)Given an  Attribute, get its trimmed value | 
| static String | getAttributeValue(StartElement startElement,
                 String tag)Get the Attribute value | 
| static Element | getDOMElement(XMLEventReader xmlEventReader)Given that the  XMLEventReaderis inXMLStreamConstants.START_ELEMENTmode, we parse into a DOM
 Element | 
| static String | getElementText(XMLEventReader xmlEventReader)Get the element text. | 
| static String | getElementText(XMLEventReader xmlEventReader,
              boolean resolveProperties)Get the element text. | 
| static String | getEndElementName(EndElement endElement)Return the name of the end element | 
| static String | getLineColumnNumber(Location location)Given a  Location, return a formatted string [lineNum,colNum] | 
| static EndElement | getNextEndElement(XMLEventReader xmlEventReader)Get the next  EndElement | 
| static XMLEvent | getNextEvent(XMLEventReader xmlEventReader)Get the next xml event | 
| static StartElement | getNextStartElement(XMLEventReader xmlEventReader)Get the next  StartElement  | 
| static String | getStartElementName(StartElement startElement)Return the name of the start element | 
| static XMLEventReader | getXMLEventReader(InputStream is)Get the XML event reader | 
| static String | getXSITypeValue(StartElement startElement)Given a start element, obtain the xsi:type defined | 
| static boolean | hasTextAhead(XMLEventReader xmlEventReader)Return whether the next event is going to be text | 
| static boolean | matches(EndElement endElement,
       String tag)Match that the end element with the expected tag | 
| static boolean | matches(StartElement startElement,
       String tag)Match that the start element with the expected tag | 
| static XMLEvent | peek(XMLEventReader xmlEventReader)Peek at the next event | 
| static EndElement | peekNextEndElement(XMLEventReader xmlEventReader)Peek the next  EndElement | 
| static StartElement | peekNextStartElement(XMLEventReader xmlEventReader)Peek the next  StartElement  | 
| static String | trim(String str)Given a string, trim it | 
| static void | validate(EndElement endElement,
        String tag)Validate that the end element has the expected tag | 
| static void | validate(StartElement startElement,
        String tag)Validate that the start element has the expected tag | 
protected static Validator validator
public static void bypassElementBlock(XMLEventReader xmlEventReader, String tag) throws ParsingException
xmlEventReader - tag - Tag of the XML element that we need to bypassParsingExceptionpublic static String getAttributeValue(Attribute attribute, boolean resolveProperties)
Attribute, get its trimmed valueattribute - resolveProperties - public static String getAttributeValue(Attribute attribute)
Attribute, get its trimmed valueattribute - public static String getAttributeValue(StartElement startElement, String tag)
startElement - tag - localpart of the qname of the attributepublic static Element getDOMElement(XMLEventReader xmlEventReader) throws ParsingException
XMLEventReader is in XMLStreamConstants.START_ELEMENT mode, we parse into a DOM
 ElementxmlEventReader - ParsingExceptionpublic static String getElementText(XMLEventReader xmlEventReader) throws ParsingException
xmlEventReader - ParsingExceptionpublic static String getElementText(XMLEventReader xmlEventReader, boolean resolveProperties) throws ParsingException
xmlEventReader - resolveProperties - ParsingExceptionpublic static XMLEventReader getXMLEventReader(InputStream is)
is - public static String getLineColumnNumber(Location location)
Location, return a formatted string [lineNum,colNum]location - public static XMLEvent getNextEvent(XMLEventReader xmlEventReader) throws ParsingException
xmlEventReader - ParsingExceptionpublic static StartElement getNextStartElement(XMLEventReader xmlEventReader) throws ParsingException
StartElement xmlEventReader - ParsingExceptionpublic static EndElement getNextEndElement(XMLEventReader xmlEventReader) throws ParsingException
EndElementxmlEventReader - ParsingExceptionpublic static String getStartElementName(StartElement startElement)
startElement - public static String getEndElementName(EndElement endElement)
endElement - public static String getXSITypeValue(StartElement startElement)
startElement - RuntimeException - if xsi:type is missingpublic static boolean hasTextAhead(XMLEventReader xmlEventReader) throws ParsingException
xmlEventReader - ParsingExceptionpublic static boolean matches(StartElement startElement, String tag)
startElement - tag - public static boolean matches(EndElement endElement, String tag)
endElement - tag - public static XMLEvent peek(XMLEventReader xmlEventReader) throws ParsingException
xmlEventReader - ParsingExceptionpublic static StartElement peekNextStartElement(XMLEventReader xmlEventReader) throws ParsingException
StartElement xmlEventReader - ParsingExceptionpublic static EndElement peekNextEndElement(XMLEventReader xmlEventReader) throws ParsingException
EndElementxmlEventReader - ParsingExceptionpublic static final String trim(String str)
str - {@code - IllegalArgumentException} if the passed str is nullpublic static void validate(StartElement startElement, String tag)
startElement - tag - RuntimeException - mismatchpublic static void validate(EndElement endElement, String tag)
endElement - tag - RuntimeException - mismatchCopyright © 2019 JBoss by Red Hat. All rights reserved.