|
Berkeley DB XML version 2.3.10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.dbxml.XmlEventReader
public class XmlEventReader
Used to read XML as events rather than serialized text.
You can obtain an instance of this object using one of
XmlDocument.getContentAsEventReader()
,
XmlValue.asEventReader()
.
You use instances of this class with XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument, com.sleepycat.dbxml.XmlUpdateContext)
,
XmlDocument.setContentAsEventReader(com.sleepycat.dbxml.XmlEventReader)
, and
XmlEventReaderToWriter
.
This class implements an iterator-style interface, and you an
manually retrieve its state using hasNext()
and
next()
, along with accessor methods.
When done with the object, its resources must be released using
close()
.
The event types are declared as static int in this class
This class allows applications direct access to the content model of stored XML without the overhead of re-parsing the document text.
Field Summary | |
---|---|
static int |
CDATA
CDATA event |
static int |
Characters
Character (text) event |
static int |
Comment
Comment event |
static int |
DTD
DTD event |
static int |
EndDocument
End document event |
static int |
EndElement
End element event |
static int |
EndEntityReference
End entity reference event |
static int |
ProcessingInstruction
Processing instruction event |
static int |
StartDocument
Start document event |
static int |
StartElement
Start element event |
static int |
StartEntityReference
Start entity reference event |
static int |
Whitespace
Ignorable whitespace event |
Constructor Summary | |
---|---|
XmlEventReader()
|
Method Summary | |
---|---|
void |
close()
Free the resources associated with this object. |
boolean |
encodingSet()
Return whether the encoding is explicitly set in the XML declaration for the document. |
int |
getAttributeCount()
Return the number of attributes for a StartElement event. |
String |
getAttributeLocalName(int index)
Return the local name of the attribute specified by the index parameter. |
String |
getAttributeNamespaceURI(int index)
Return the namespace URI of the attribute specified by the index parameter. |
String |
getAttributePrefix(int index)
Return the prefix of the attribute specified by the index parameter. |
String |
getAttributeValue(int index)
Return the text value of the attribute specified by the index parameter. |
String |
getEncoding()
Return the character encoding. |
int |
getEventType()
Return the event type of the current position. |
boolean |
getExpandEntities()
Determine whether you will read events that are part of an expanded entity reference. |
String |
getLocalName()
Return the local name of the StartElement event at the current position. |
String |
getNamespaceURI()
Return the namespace URI of the StartElement event at the current position. |
String |
getPrefix()
Return the namespace prefix of the StartElement event at the current position. |
boolean |
getReportEntityInfo()
Determine whether you will read events indicating the start and end of entity references and expansion. |
String |
getSystemId()
Return the system ID of the document, if available. |
String |
getValue()
Return the text value of the current event. |
String |
getVersion()
Return the XML version string. |
boolean |
hasEmptyElementInfo()
Return whether the implementation keeps track of empty elements. |
boolean |
hasEntityEscapeInfo()
Return whether the object is able to accurately determine if a given text value may require escaping of entities. |
boolean |
hasNext()
Return true if there is another valid event remaining |
boolean |
isAttributeSpecified(int index)
Return whether the attribute specified by the index is specified in the document (vs defaulted). |
boolean |
isEmptyElement()
Return whether the current event is StartElement with an empty element. |
boolean |
isStandalone()
Return whether the document is standalone. |
boolean |
isWhiteSpace()
Return whether the current text value is entirely white space. |
boolean |
needsEntityEscape()
Return whether the text value of the current event requires escaping. |
boolean |
needsEntityEscape(int index)
Return whether the text value of the attribute specified by the index parameter requires escaping. |
int |
next()
Move to the next event, returning its type. |
int |
nextTag()
Move to the next event that is of type StartElement, EndElement, returning its type. |
void |
setExpandEntities(boolean value)
Tell the object whether you want to read events that are part of an expanded entity reference. |
void |
setReportEntityInfo(boolean value)
Tell the object whether you want to read events indicating the start and end of entity references and expansion. |
boolean |
standaloneSet()
Return whether the standalone is set in the XML declaration for the document |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int StartElement
public static final int EndElement
public static final int Characters
public static final int CDATA
public static final int Comment
public static final int Whitespace
public static final int StartDocument
public static final int EndDocument
public static final int StartEntityReference
public static final int EndEntityReference
public static final int ProcessingInstruction
public static final int DTD
Constructor Detail |
---|
public XmlEventReader()
Method Detail |
---|
public void close() throws XmlException
XmlException
public void setReportEntityInfo(boolean value) throws XmlException
BDB XML maintains this information internally in order to provide
more accurate round-tripping of documents with entities. By default,
the start and end entity events are not reported. Not all implementations
of XmlEventReader
will support these events. Use
getReportEntityInfo()
to determine the actual state.
value
- Set to true if you want to see StartEntityReference and
EndEntityReference events.
XmlException
public boolean getReportEntityInfo() throws XmlException
BDB XML maintains this information internally in order to provide
more accurate round-tripping of documents with entities. By default,
the start and end entity events are not reported. Not all implementations
of XmlEventReader
will support these events. Use
setReportEntityInfo(boolean)
to change the state for
those implementations that support it.
XmlException
public void setExpandEntities(boolean value) throws XmlException
BDB XML maintains start and end of entity references
internally in order to provide
more accurate round-tripping of documents with entities.
This interface controls whether you see the events from the
expanded reference. For example, if you set this value to
false, and set setReportEntityInfo(boolean)
to true, you
will see just the entity references themselves, and will suppress
the expanded information. This can be useful for round-tripping of
documents.
Use getExpandEntities()
to determine the actual state.
value
- Set to true if you want to see events from expanded
entities.
XmlException
public boolean getExpandEntities() throws XmlException
BDB XML maintains start and end of entity references
internally in order to provide
more accurate round-tripping of documents with entities.
Use setExpandEntities(boolean)
to change the state.
XmlException
public int next() throws XmlException
This method will throw an exception if hasNext()
is
false.
XmlException
public int nextTag() throws XmlException
This method will throw an exception if it does not find a StartElement or EndElement tag. It is best used when iterating through structured content, avoiding text and whitespace.
XmlException
public boolean hasNext() throws XmlException
XmlException
public int getEventType() throws XmlException
XmlException
public String getNamespaceURI() throws XmlException
XmlException
public String getLocalName() throws XmlException
If the current event is ProcessingInstruction, the target portion
is returned
is thrown. The target portion is returned. The data portion of
a ProcessingInstruction event is returned
using getValue()
.
XmlException
public String getPrefix() throws XmlException
XmlException
public String getValue() throws XmlException
If the current event is ProcessingInstruction, the data portion
is returned using this interface. The target is returned using
getLocalName()
.
XmlException
public int getAttributeCount() throws XmlException
XmlException
public boolean isAttributeSpecified(int index) throws XmlException
index
- The index of the attribute in the current element's attribute list
XmlException
public String getAttributeLocalName(int index) throws XmlException
index
- The index of the attribute in the current element's attribute list
XmlException
public String getAttributeNamespaceURI(int index) throws XmlException
index
- The index of the attribute in the current element's attribute list
XmlException
public String getAttributePrefix(int index) throws XmlException
index
- The index of the attribute in the current element's attribute list
XmlException
public String getAttributeValue(int index) throws XmlException
index
- The index of the attribute in the current element's attribute list
XmlException
public String getEncoding() throws XmlException
XmlException
public String getVersion() throws XmlException
XmlException
public String getSystemId() throws XmlException
XmlException
public boolean isStandalone() throws XmlException
XmlException
public boolean standaloneSet() throws XmlException
XmlException
public boolean encodingSet() throws XmlException
XmlException
public boolean hasEntityEscapeInfo() throws XmlException
XmlException
public boolean needsEntityEscape(int index) throws XmlException
index
- The index of the attribute in the current element's attribute list
XmlException
public boolean needsEntityEscape() throws XmlException
XmlException
public boolean hasEmptyElementInfo() throws XmlException
XmlException
public boolean isEmptyElement() throws XmlException
XmlException
public boolean isWhiteSpace() throws XmlException
XmlException
|
Berkeley DB XML version 2.3.10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |