本文整理汇总了Java中android.content.res.XmlResourceParser.END_DOCUMENT属性的典型用法代码示例。如果您正苦于以下问题:Java XmlResourceParser.END_DOCUMENT属性的具体用法?Java XmlResourceParser.END_DOCUMENT怎么用?Java XmlResourceParser.END_DOCUMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.res.XmlResourceParser
的用法示例。
在下文中一共展示了XmlResourceParser.END_DOCUMENT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
private void parse() {
try {
parser.next();
int eventType = parser.getEventType();
while (eventType != XmlResourceParser.END_DOCUMENT) {
if(eventType == XmlResourceParser.START_TAG) {
parseNewTab(parser);
} else if(eventType == XmlResourceParser.END_TAG) {
if (parser.getName().equals("tab")) {
if (workingTab != null) {
tabs.add(workingTab);
workingTab = null;
}
}
}
eventType = parser.next();
}
} catch (IOException | XmlPullParserException e) {
e.printStackTrace();
throw new TabParserException();
}
}
示例2: findProviderForDomain
private Provider findProviderForDomain(String domain) {
try {
XmlResourceParser xml = getResources().getXml(R.xml.providers);
int xmlEventType;
Provider provider = null;
while ((xmlEventType = xml.next()) != XmlResourceParser.END_DOCUMENT) {
if (xmlEventType == XmlResourceParser.START_TAG
&& "provider".equals(xml.getName())
&& domain.equalsIgnoreCase(getXmlAttribute(xml, "domain"))) {
provider = new Provider();
provider.id = getXmlAttribute(xml, "id");
provider.label = getXmlAttribute(xml, "label");
provider.domain = getXmlAttribute(xml, "domain");
provider.note = getXmlAttribute(xml, "note");
} else if (xmlEventType == XmlResourceParser.START_TAG
&& "incoming".equals(xml.getName())
&& provider != null) {
provider.incomingUriTemplate = new URI(getXmlAttribute(xml, "uri"));
provider.incomingUsernameTemplate = getXmlAttribute(xml, "username");
} else if (xmlEventType == XmlResourceParser.START_TAG
&& "outgoing".equals(xml.getName())
&& provider != null) {
provider.outgoingUriTemplate = new URI(getXmlAttribute(xml, "uri"));
provider.outgoingUsernameTemplate = getXmlAttribute(xml, "username");
} else if (xmlEventType == XmlResourceParser.END_TAG
&& "provider".equals(xml.getName())
&& provider != null) {
return provider;
}
}
} catch (Exception e) {
Timber.e(e, "Error while trying to load provider settings.");
}
return null;
}
示例3: readValidCertificates
private Map<String, ArrayList<CallerInfo>> readValidCertificates(XmlResourceParser parser) {
HashMap<String, ArrayList<CallerInfo>> validCertificates = new HashMap<>();
try {
int eventType = parser.next();
while (eventType != XmlResourceParser.END_DOCUMENT) {
if (eventType == XmlResourceParser.START_TAG
&& parser.getName().equals("signing_certificate")) {
String name = parser.getAttributeValue(null, "name");
String packageName = parser.getAttributeValue(null, "package");
boolean isRelease = parser.getAttributeBooleanValue(null, "release", false);
String certificate = parser.nextText().replaceAll("\\s|\\n", "");
CallerInfo info = new CallerInfo(name, packageName, isRelease);
ArrayList<CallerInfo> infos = validCertificates.get(certificate);
if (infos == null) {
infos = new ArrayList<>();
validCertificates.put(certificate, infos);
}
/*Log.v(TAG, "Adding allowed caller: " + info.name +
" package=" + info.packageName + " release=" + info.release +
" certificate=" + certificate);*/
infos.add(info);
}
eventType = parser.next();
}
} catch (XmlPullParserException | IOException e) {
Log.e(TAG, e + "Could not read allowed callers from XML.");
}
return validCertificates;
}