| Modifier and Type | Field and Description |
|---|---|
| private static final BadgerFishConvention | |
| private String | |
| private FastStack |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements javax. |
| public String | getAttributeType(int
the position of the attribute arg0)Overrides org. Implements javax. |
| public String | getCharacterEncodingScheme()
Overrides org. Implements javax. |
| public String | getElementText()
Implements javax. |
| public NamespaceContext | getNamespaceContext()
Implements javax. |
| public String | getText()
Implements javax. |
| public int | next()
Implements javax. |
| private void | |
| private void |
| CONVENTION | back to summary |
|---|---|
| private static final BadgerFishConvention CONVENTION | |
| currentText | back to summary |
|---|---|
| private String currentText | |
| nodes | back to summary |
|---|---|
| private FastStack nodes | |
| BadgerFishXMLStreamReader | back to summary |
|---|---|
| public BadgerFishXMLStreamReader(JSONObject obj) throws JSONException, XMLStreamException | |
| close | back to summary |
|---|---|
| public void close() throws XMLStreamException Implements javax. Doc from javax. Frees any resources associated with this Reader. This method does not close the underlying input source.
| |
| getAttributeType | back to summary |
|---|---|
| public String getAttributeType(int arg0) Overrides org. Implements javax. Doc from javax. Returns the XML type of the attribute at the provided index
| |
| getCharacterEncodingScheme | back to summary |
|---|---|
| public String getCharacterEncodingScheme() Overrides org. Implements javax. Doc from javax. Returns the character encoding declared on the xml declaration Returns null if none was declared
| |
| getElementText | back to summary |
|---|---|
| public String getElementText() throws XMLStreamException Implements javax. Doc from javax. Reads the content of a text-only element, an exception is thrown if this is
not a text-only element.
Regardless of value of javax.xml.stream.isCoalescing this method always returns coalesced content.
if(getEventType() != XMLStreamConstants.START_ELEMENT) {
throw new XMLStreamException(
"parser must be on START_ELEMENT to read next text", getLocation());
}
int eventType = next();
StringBuffer content = new StringBuffer();
while(eventType != XMLStreamConstants.END_ELEMENT) {
if(eventType == XMLStreamConstants.CHARACTERS
|| eventType == XMLStreamConstants.CDATA
|| eventType == XMLStreamConstants.SPACE
|| eventType == XMLStreamConstants.ENTITY_REFERENCE) {
buf.append(getText());
} else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
|| eventType == XMLStreamConstants.COMMENT) {
// skipping
} else if(eventType == XMLStreamConstants.END_DOCUMENT) {
throw new XMLStreamException(
"unexpected end of document when reading element text content", this);
} else if(eventType == XMLStreamConstants.START_ELEMENT) {
throw new XMLStreamException(
"element text content may not contain START_ELEMENT", getLocation());
} else {
throw new XMLStreamException(
"Unexpected event type "+eventType, getLocation());
}
eventType = next();
}
return buf.toString();
| |
| getNamespaceContext | back to summary |
|---|---|
| public NamespaceContext getNamespaceContext() Implements javax. Doc from javax. Returns a read only namespace context for the current position. The context is transient and only valid until a call to next() changes the state of the reader.
| |
| getText | back to summary |
|---|---|
| public String getText() Implements javax. Doc from javax. Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD. If an ENTITY_REFERENCE has been resolved, any character data will be reported as CHARACTERS events.
| |
| next | back to summary |
|---|---|
| public int next() throws XMLStreamException Implements javax. Doc from javax. Get next parsing event - a processor may return all contiguous character data in a single chunk, or it may split it into several chunks. If the property javax.xml.stream.isCoalescing is set to true element content must be coalesced and only one CHARACTERS event must be returned for contiguous element content or CDATA Sections. By default entity references must be expanded and reported transparently to the application. An exception will be thrown if an entity reference cannot be expanded. If element content is empty (i.e. content is "") then no CHARACTERS event will be reported. Given the following XML: Note empty element (such as
| |
| processElement | back to summary |
|---|---|
| private void processElement() throws XMLStreamException | |
| processKey | back to summary |
|---|---|
| private void processKey(String nextKey, Object newObj) throws JSONException, XMLStreamException | |