本文整理汇总了Java中org.kxml2.io.KXmlParser.END_DOCUMENT属性的典型用法代码示例。如果您正苦于以下问题:Java KXmlParser.END_DOCUMENT属性的具体用法?Java KXmlParser.END_DOCUMENT怎么用?Java KXmlParser.END_DOCUMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.kxml2.io.KXmlParser
的用法示例。
在下文中一共展示了KXmlParser.END_DOCUMENT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: parseProgressFromRetryResult
private boolean parseProgressFromRetryResult(RemoteDataPullResponse response) {
try {
InputStream stream = response.writeResponseToCache(syncTask.context).retrieveCache();
KXmlParser parser = ElementParser.instantiateParser(stream);
parser.next();
int eventType = parser.getEventType();
do {
if (eventType == KXmlParser.START_TAG) {
if (parser.getName().toLowerCase().equals("progress")) {
serverProgressCompletedSoFar = Integer.parseInt(
parser.getAttributeValue(null, "done"));
serverProgressTotal = Integer.parseInt(
parser.getAttributeValue(null, "total"));
return true;
}
}
eventType = parser.next();
} while (eventType != KXmlParser.END_DOCUMENT);
} catch (IOException | XmlPullParserException e) {
Logger.log(LogTypes.TYPE_USER,
"Error while parsing progress values of retry result");
}
return false;
}
示例4: parse
@Override
public List<AppAvailableToInstall> parse() throws InvalidStructureException, IOException,
XmlPullParserException, UnfullfilledRequirementsException {
checkNode(APPS_TAG);
List<AppAvailableToInstall> appsList = new ArrayList<>();
parser.next();
int eventType = parser.getEventType();
do {
if (eventType == KXmlParser.START_TAG) {
String tagName = parser.getName().toLowerCase();
if (APP_TAG.equals(tagName)) {
String domain = parser.getAttributeValue(null, DOMAIN_TAG);
String appName = parser.getAttributeValue(null, APP_NAME_TAG);
String profileRef = parser.getAttributeValue(null, PROFILE_REF_TAG);
String mediaProfileRef = parser.getAttributeValue(null, MEDIA_PROFILE_REF_TAG);
appsList.add(new AppAvailableToInstall(domain, appName, profileRef, mediaProfileRef));
}
}
eventType = parser.next();
} while (eventType != KXmlParser.END_DOCUMENT);
commit(appsList);
return appsList;
}
示例5: 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;
}
示例6: 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;
}
示例7: parse
@Override
public Profile parse() throws InvalidStructureException, IOException, XmlPullParserException,
UnfullfilledRequirementsException {
checkNode("profile");
Profile profile = parseProfileElement();
try {
parser.next();
int eventType;
eventType = parser.getEventType();
do {
if (eventType == KXmlParser.START_TAG) {
if (parser.getName().toLowerCase().equals("property")) {
parseProperty(profile);
} else if (parser.getName().toLowerCase().equals("root")) {
RootTranslator root = new RootParser(this.parser).parse();
profile.addRoot(root);
} else if (parser.getName().toLowerCase().equals("login")) {
parseLogin();
} else if (parser.getName().toLowerCase().equals("features")) {
parseFeatures(profile);
} else if (parser.getName().toLowerCase().equals("suite")) {
parseSuite();
} else {
System.out.println("Unrecognized Tag: "
+ parser.getName());
}
}
eventType = parser.next();
} while (eventType != KXmlParser.END_DOCUMENT);
return profile;
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new InvalidStructureException("Pull Parse Exception, malformed XML.", parser);
}
}