Package org.dellroad.stuff.xml
Class AnnotatedXMLStreamReader
java.lang.Object
javax.xml.stream.util.StreamReaderDelegate
org.dellroad.stuff.xml.AnnotatedXMLStreamReader
- All Implemented Interfaces:
- XMLStreamConstants,- XMLStreamReader
- Direct Known Subclasses:
- UpdatesXMLStreamReader
XMLStreamReader that reads and removes an initial annotation element from an XML document.
 The annotation element, if present, must be the first element inside the top-level document element.
 When the annotation element is encountered, readAnnotationElement() will be invoked.
 
 This class can be used in combination with AnnotatedXMLStreamWriter to transparently annotate XML documents.
- See Also:
- 
Field SummaryFields inherited from interface javax.xml.stream.XMLStreamConstantsATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintnext()intnextTag()protected abstract booleanreadAnnotationElement(XMLStreamReader reader) Determine if the givenXMLStreamReaderis positioned at the annotation element, and if so, read it.Methods inherited from class javax.xml.stream.util.StreamReaderDelegateclose, getAttributeCount, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getElementText, getEncoding, getEventType, getLocalName, getLocation, getName, getNamespaceContext, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getParent, getPIData, getPITarget, getPrefix, getProperty, getText, getTextCharacters, getTextCharacters, getTextLength, getTextStart, getVersion, hasName, hasNext, hasText, isAttributeSpecified, isCharacters, isEndElement, isStandalone, isStartElement, isWhiteSpace, require, setParent, standaloneSet
- 
Constructor Details- 
AnnotatedXMLStreamReaderConstructor.- Parameters:
- parent- parent reader
 
 
- 
- 
Method Details- 
next- Specified by:
- nextin interface- XMLStreamReader
- Overrides:
- nextin class- StreamReaderDelegate
- Throws:
- XMLStreamException
 
- 
nextTag- Specified by:
- nextTagin interface- XMLStreamReader
- Overrides:
- nextTagin class- StreamReaderDelegate
- Throws:
- XMLStreamException
 
- 
readAnnotationElementDetermine if the givenXMLStreamReaderis positioned at the annotation element, and if so, read it.When this method is invoked, the reader's current event has typeXMLStreamConstants.START_ELEMENTand may represent the start of the annotation element. If it doesn't, this method should not read any events and immediately return false. Otherwise, this method should read subsequent events up through the correspondingXMLStreamConstants.END_ELEMENTevent and return true. Upon return, thereader's current event will have typeXMLStreamConstants.END_ELEMENT.- Parameters:
- reader- source from which the the annotation element is to be read, if found
- Returns:
- true if the current event is the start of the annotation element and has been read, false otherwise
- Throws:
- XMLStreamException- if an XML parse error occurs
 
 
-