本文整理汇总了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;
}