本文整理汇总了Java中org.kxml2.io.KXmlParser.START_DOCUMENT属性的典型用法代码示例。如果您正苦于以下问题:Java KXmlParser.START_DOCUMENT属性的具体用法?Java KXmlParser.START_DOCUMENT怎么用?Java KXmlParser.START_DOCUMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.kxml2.io.KXmlParser
的用法示例。
在下文中一共展示了KXmlParser.START_DOCUMENT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: skipBlock
public void skipBlock(String tag) throws XmlPullParserException, IOException {
while(parser.getEventType() != KXmlParser.END_DOCUMENT) {
int eventType;
eventType = parser.next();
if(eventType == KXmlParser.START_DOCUMENT) {
} else if(eventType == KXmlParser.END_DOCUMENT) {
return;
} else if(eventType == KXmlParser.START_TAG) {
} else if(eventType == KXmlParser.END_TAG) {
if(parser.getName().equals(tag)) {
return;
}
} else if(eventType == KXmlParser.TEXT) {
}
}
}
示例2: skipBlock
public void skipBlock(String tag) throws XmlPullParserException, IOException {
while (parser.getEventType() != KXmlParser.END_DOCUMENT) {
int eventType;
eventType = parser.next();
if (eventType == KXmlParser.START_DOCUMENT) {
} else if (eventType == KXmlParser.END_DOCUMENT) {
return;
} else if (eventType == KXmlParser.START_TAG) {
} else if (eventType == KXmlParser.END_TAG) {
if (parser.getName().equals(tag)) {
return;
}
} else if (eventType == KXmlParser.TEXT) {
}
}
}
示例3: nextTagInBlock
/**
* Retrieves the next tag in the XML document which is internal
* to the tag identified by terminal. If there are no further tags
* inside this tag, false will be returned.
*
* @param terminal The name of the tag which the next tag expected
* should be inside of.
*
* @throws InvalidStructureException If any invalid CommCare XML structures are
* detected.
* @throws IOException If the parser has a problem reading the document
* @throws XmlPullParserException If the stream does not contain well-formed
* XML.
*/
protected boolean nextTagInBlock(String terminal) throws InvalidStructureException, IOException, XmlPullParserException {
int eventType;
//eventType = parser.nextTag();
eventType = parser.next();
if(eventType == KXmlParser.TEXT && parser.isWhitespace()) { // skip whitespace
eventType = parser.next();
}
if(eventType == KXmlParser.START_DOCUMENT) {
//
} else if(eventType == KXmlParser.END_DOCUMENT) {
return false;
} else if(eventType == KXmlParser.START_TAG) {
return true;
} else if(eventType == KXmlParser.END_TAG) {
//If we've reached the end of the current node path,
//return false (signaling that the parsing action should end).
if(parser.getName().toLowerCase().equals(terminal.toLowerCase())) { return false; }
//Elsewise, as long as we haven't left the current context, keep diving
else if(parser.getDepth() >= level) { return nextTagInBlock(terminal); }
//if we're below the limit, get out.
else { return false; }
} else if(eventType == KXmlParser.TEXT) {
return true;
}
return true;
}
示例4: nextTagInBlock
/**
* Retrieves the next tag in the XML document which is internal
* to the tag identified by terminal. If there are no further tags
* inside this tag, false will be returned.
*
* @param terminal The name of the tag which the next tag expected
* should be inside of.
* @throws InvalidStructureException If any invalid XML structures are
* detected.
* @throws IOException If the parser has a problem reading the document
* @throws XmlPullParserException If the stream does not contain well-formed
* XML.
*/
protected boolean nextTagInBlock(String terminal) throws InvalidStructureException, IOException, XmlPullParserException {
int eventType;
//eventType = parser.nextTag();
eventType = parser.next();
while (eventType == KXmlParser.TEXT && parser.isWhitespace()) { // skip whitespace
eventType = parser.next();
}
if (eventType == KXmlParser.START_DOCUMENT) {
//
} else if (eventType == KXmlParser.END_DOCUMENT) {
return false;
} else if (eventType == KXmlParser.START_TAG) {
return true;
} else if (eventType == KXmlParser.END_TAG) {
//If we've reached the end of the current node path,
//return false (signaling that the parsing action should end).
if (isTagNamed(terminal)) {
return false;
}
//Elsewise, as long as we haven't left the current context, keep diving
else if (parser.getDepth() >= level) {
return nextTagInBlock(terminal);
}
//if we're below the limit, get out.
else {
return false;
}
} else if (eventType == KXmlParser.TEXT) {
return true;
}
return true;
}