public abstract class AbstractXMLStreaming extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractXMLStreaming() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
expect(XMLStreamReader reader,
boolean closingOK,
QName... names)
Scan forward until we see an opening or closing tag.
|
protected void |
expectClose(XMLStreamReader reader)
Scan forward expecting to see a closing tag.
|
protected String |
getAttr(XMLStreamReader reader,
QName name)
Get a requried attribute from the current element.
|
protected String |
getAttr(XMLStreamReader reader,
QName name,
boolean required)
Get an attribute from the current element.
|
protected boolean |
getBooleanAttr(XMLStreamReader reader,
QName name)
Get a requried boolean attribute from the current element.
|
protected Boolean |
getBooleanAttr(XMLStreamReader reader,
QName name,
boolean required)
Get an attribute from the current element and parse as a boolean value.
|
protected int |
getIntAttr(XMLStreamReader reader,
QName name)
Get a requried integer attribute from the current element.
|
protected Integer |
getIntAttr(XMLStreamReader reader,
QName name,
boolean required)
Get an attribute from the current element and parse as a decimal integer value.
|
protected Long |
getLongAttr(XMLStreamReader reader,
QName name,
boolean required)
Get an attribute from the current element and parse as a decimal long value.
|
protected void |
writeElement(XMLStreamWriter writer,
QName element,
String content)
Write out a simple XML element containing the given content.
|
protected boolean expect(XMLStreamReader reader, boolean closingOK, QName... names) throws XMLStreamException
names and then we return true, if not or if names
is empty throw an exception; if a closing tag is seen, return false if closingOK, else throw exception.reader - XML inputclosingOK - true if a closing tag is OK, otherwise falsenames - expected opening tag, or null if we expected a closing tagXMLStreamException - if something unexpected is encounteredprotected void expectClose(XMLStreamReader reader) throws XMLStreamException
reader - XML inputXMLStreamException - if something other than a closing tag is encounteredprotected void writeElement(XMLStreamWriter writer, QName element, String content) throws XMLStreamException
writer - XML outputelement - element namecontent - simple contentXMLStreamException - if error occurs writing outputprotected String getAttr(XMLStreamReader reader, QName name, boolean required) throws XMLStreamException
reader - XML inputname - attribute namerequired - whether attribute must be presentrequired and no attribute is presentIllegalStateException - if the current event is not a start element eventXMLStreamException - if required is true and no such attribute is foundprotected String getAttr(XMLStreamReader reader, QName name) throws XMLStreamException
getAttr(reader, name, true).reader - XML inputname - attribute nameIllegalStateException - if the current event is not a start element eventXMLStreamException - if no such attribute is foundprotected Integer getIntAttr(XMLStreamReader reader, QName name, boolean required) throws XMLStreamException
reader - XML inputname - attribute namerequired - whether attribute must be presentrequired and no attribute is presentIllegalStateException - if the current event is not a start element eventXMLStreamException - if required is true and no such attribute is foundXMLStreamException - if attribute is not an integer valueprotected Long getLongAttr(XMLStreamReader reader, QName name, boolean required) throws XMLStreamException
reader - XML inputname - attribute namerequired - whether attribute must be presentrequired and no attribute is presentIllegalStateException - if the current event is not a start element eventXMLStreamException - if required is true and no such attribute is foundXMLStreamException - if attribute is not an integer valueprotected int getIntAttr(XMLStreamReader reader, QName name) throws XMLStreamException
getIntAttr(reader, name, true).reader - XML inputname - attribute nameIllegalStateException - if the current event is not a start element eventXMLStreamException - if no such attribute is foundXMLStreamException - if attribute is not an integer valueprotected Boolean getBooleanAttr(XMLStreamReader reader, QName name, boolean required) throws XMLStreamException
reader - XML inputname - attribute namerequired - whether attribute must be presentrequired and no attribute is presentIllegalStateException - if the current event is not a start element eventXMLStreamException - if required is true and no such attribute is foundXMLStreamException - if attribute is not "true" or "false"protected boolean getBooleanAttr(XMLStreamReader reader, QName name) throws XMLStreamException
getBooleanAttr(reader, name, true).reader - XML inputname - attribute nameIllegalStateException - if the current event is not a start element eventXMLStreamException - if no such attribute is foundXMLStreamException - if attribute is not "true" or "false"Copyright © 2016. All rights reserved.