本文整理匯總了Java中javax.xml.stream.events.XMLEvent.END_DOCUMENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java XMLEvent.END_DOCUMENT屬性的具體用法?Java XMLEvent.END_DOCUMENT怎麽用?Java XMLEvent.END_DOCUMENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.xml.stream.events.XMLEvent
的用法示例。
在下文中一共展示了XMLEvent.END_DOCUMENT屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findNextEvent
private int findNextEvent() throws XMLStreamException {
fStreamAdvancedByHasNext = false;
while(fStreamReader.hasNext()){
fCurrentEvent = fStreamReader.next();
if(fStreamFilter.accept(fStreamReader)){
fEventAccepted = true;
return fCurrentEvent;
}
}
//although it seems that IllegalStateException should be thrown when next() is called
//on a stream that has no more items, we have to assume END_DOCUMENT is always accepted
//in order to pass the TCK
if (fCurrentEvent == XMLEvent.END_DOCUMENT)
return fCurrentEvent;
else
return -1;
}
示例2: seek
/**
* Seek to an identifier in this stream.
*
* @param id The identifier to find.
* @return This {@code FreeColXMLReader} positioned such that the
* required identifier is current, or null on error or if not found.
* @exception XMLStreamException if a problem was encountered
* during parsing.
*/
public FreeColXMLReader seek(String id) throws XMLStreamException {
nextTag();
for (int type = getEventType(); type != XMLEvent.END_DOCUMENT;
type = getEventType()) {
if (type == XMLEvent.START_ELEMENT
&& id.equals(readId())) return this;
nextTag();
}
return null;
}
示例3: findNextTag
private int findNextTag() throws XMLStreamException {
fStreamAdvancedByHasNext = false;
while(fStreamReader.hasNext()){
fCurrentEvent = fStreamReader.nextTag();
if(fStreamFilter.accept(fStreamReader)){
fEventAccepted = true;
return fCurrentEvent;
}
}
if (fCurrentEvent == XMLEvent.END_DOCUMENT)
return fCurrentEvent;
else
return -1;
}
示例4: hasNext
/**
* @throws XMLStreamException
* @return
*/
public boolean hasNext() throws XMLStreamException {
//the scanner returns -1 when it detects a broken stream
if (fEventType == -1) return false;
//we can check in scanners if the scanner state is not set to
//terminating, we still have more events.
return fEventType != XMLEvent.END_DOCUMENT;
}
示例5: getEventTypeString
final static String getEventTypeString(int eventType) {
switch (eventType){
case XMLEvent.START_ELEMENT:
return "START_ELEMENT";
case XMLEvent.END_ELEMENT:
return "END_ELEMENT";
case XMLEvent.PROCESSING_INSTRUCTION:
return "PROCESSING_INSTRUCTION";
case XMLEvent.CHARACTERS:
return "CHARACTERS";
case XMLEvent.COMMENT:
return "COMMENT";
case XMLEvent.START_DOCUMENT:
return "START_DOCUMENT";
case XMLEvent.END_DOCUMENT:
return "END_DOCUMENT";
case XMLEvent.ENTITY_REFERENCE:
return "ENTITY_REFERENCE";
case XMLEvent.ATTRIBUTE:
return "ATTRIBUTE";
case XMLEvent.DTD:
return "DTD";
case XMLEvent.CDATA:
return "CDATA";
case XMLEvent.SPACE:
return "SPACE";
}
return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
}
示例6: hasNext
/**
* @throws XMLStreamException
* @return
*/
public boolean hasNext() throws XMLStreamException {
//the scanner returns -1 when it detects a broken stream
if (fEventType == -1) {
return false;
}
//we can check in scanners if the scanner state is not set to
//terminating, we still have more events.
return fEventType != XMLEvent.END_DOCUMENT;
}
示例7: getEventTypeString
final static String getEventTypeString(int eventType) {
switch (eventType) {
case XMLEvent.START_ELEMENT:
return "START_ELEMENT";
case XMLEvent.END_ELEMENT:
return "END_ELEMENT";
case XMLEvent.PROCESSING_INSTRUCTION:
return "PROCESSING_INSTRUCTION";
case XMLEvent.CHARACTERS:
return "CHARACTERS";
case XMLEvent.COMMENT:
return "COMMENT";
case XMLEvent.START_DOCUMENT:
return "START_DOCUMENT";
case XMLEvent.END_DOCUMENT:
return "END_DOCUMENT";
case XMLEvent.ENTITY_REFERENCE:
return "ENTITY_REFERENCE";
case XMLEvent.ATTRIBUTE:
return "ATTRIBUTE";
case XMLEvent.DTD:
return "DTD";
case XMLEvent.CDATA:
return "CDATA";
case XMLEvent.SPACE:
return "SPACE";
}
return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
}
示例8: testNextEvent
private static void testNextEvent(int max)
throws IOException, XMLStreamException {
System.out.println("\nTest nextEvent (" + max + ")...");
XMLEventReader reader = createXmlReader(max);
XMLEvent event;
do {
event = reader.nextEvent();
System.out.println(event);
} while (event.getEventType() != XMLEvent.END_DOCUMENT);
System.out.println("nextEvent passed\n");
}
示例9: isEndDocument
public boolean isEndDocument() {
return fEventType == XMLEvent.END_DOCUMENT;
}