Package eu.europa.ec.taxud.cesop.readers
Class XmlStreamReaderWrapper
- java.lang.Object
-
- eu.europa.ec.taxud.cesop.readers.XmlStreamReaderWrapper
-
public final class XmlStreamReaderWrapper extends Object
Wrapper for stream reader.
-
-
Constructor Summary
Constructors Constructor Description XmlStreamReaderWrapper(InputStream inputStream, org.codehaus.stax2.validation.XMLValidationSchema xsdSchema)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
getAttributes()
Returns the list of attributes.String
getCharacters()
Returns the element characters.QName
getEndElementName()
Returns the current end tag name.QName
getStartElementName()
Returns the current start tag name.boolean
goToNextStartElement()
Goes to the next XML start element.boolean
goToNextStartElement(QName qName)
Goes to the next XML start element with specified QName.boolean
hasNext()
Returns true if there are more parsing events and false if there are no more events.boolean
isCharactersElement()
Returns true if the current event type is a characters element, false otherwise.boolean
isEndElement()
Returns true if the current event type is an end element, false otherwise.boolean
isStartElement()
Returns true if the current event type is a start element, false otherwise.void
markAsPeek()
Mark as peek.void
moveToNextElement()
Moves to the next element.
-
-
-
Constructor Detail
-
XmlStreamReaderWrapper
public XmlStreamReaderWrapper(InputStream inputStream, org.codehaus.stax2.validation.XMLValidationSchema xsdSchema) throws XMLStreamException
- Throws:
XMLStreamException
-
-
Method Detail
-
markAsPeek
public void markAsPeek()
Mark as peek.
-
hasNext
public boolean hasNext() throws XMLStreamException
Returns true if there are more parsing events and false if there are no more events. This method will return false if the current state of the XMLStreamReader is END_DOCUMENT.- Returns:
- true if there are more events, false otherwise
- Throws:
XMLStreamException
- in case of error while processing the XML content
-
moveToNextElement
public void moveToNextElement() throws XMLStreamException
Moves to the next element. This method will throw an IllegalStateException if it is called after hasNext() returns false.- Throws:
XMLStreamException
- in case of error while processing the XML content
-
isStartElement
public boolean isStartElement()
Returns true if the current event type is a start element, false otherwise.- Returns:
- true if the current event type is a start element.
-
isCharactersElement
public boolean isCharactersElement()
Returns true if the current event type is a characters element, false otherwise.- Returns:
- true if the current event type is a characters element.
-
isEndElement
public boolean isEndElement()
Returns true if the current event type is an end element, false otherwise.- Returns:
- true if the current event type is an end element.
-
goToNextStartElement
public boolean goToNextStartElement() throws XMLStreamException
Goes to the next XML start element.- Returns:
- true if a start element is found, false otherwise
- Throws:
XMLStreamException
- in case of error while processing the XML content
-
goToNextStartElement
public boolean goToNextStartElement(QName qName) throws XMLStreamException
Goes to the next XML start element with specified QName.- Parameters:
qName
- the name of the start element to search for- Returns:
- true if the start element is found, false otherwise
- Throws:
XMLStreamException
- in case of error while processing the XML content
-
getStartElementName
public QName getStartElementName() throws XMLStreamException
Returns the current start tag name.- Returns:
- the tag name
- Throws:
XMLStreamException
- if the current event type is not a start element
-
getEndElementName
public QName getEndElementName() throws XMLStreamException
Returns the current end tag name.- Returns:
- the tag name
- Throws:
XMLStreamException
- if the current event type is not an end element
-
getCharacters
public String getCharacters() throws XMLStreamException
Returns the element characters.- Returns:
- the element characters
- Throws:
XMLStreamException
- if the current event type is not a characters element
-
getAttributes
public Map<String,String> getAttributes() throws XMLStreamException
Returns the list of attributes.- Returns:
- a list of attributes (name, value)
- Throws:
XMLStreamException
- if the current event type is not an attribute element
-
-