本文整理汇总了Java中org.xmlpull.v1.XmlPullParser.END_TAG属性的典型用法代码示例。如果您正苦于以下问题:Java XmlPullParser.END_TAG属性的具体用法?Java XmlPullParser.END_TAG怎么用?Java XmlPullParser.END_TAG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.xmlpull.v1.XmlPullParser
的用法示例。
在下文中一共展示了XmlPullParser.END_TAG属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inflateChildren
private void inflateChildren(XmlPullParser parser, Node node) throws IOException, XmlPullParserException {
final int depth=parser.getDepth();
int type;
while (((type = parser.next()) != XmlPullParser.END_TAG ||
parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
if(type!=XmlPullParser.START_TAG){
continue;
}
String tagName=parser.getName();
//创建当前标签Node
Node view=createNodeFromTag(tagName);
if(view!=null&&node instanceof ViewGroup){
ViewGroup viewGroup= (ViewGroup) node;
//查找当前标签其内是否还有其他标签如果没有就直接返回
inflateChildren(parser,view);
viewGroup.addNode(view);
}
}
}
示例2: skip
private static void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
if (parser.getEventType() != XmlPullParser.START_TAG) {
throw new IllegalStateException();
}
int depth = 1;
while (depth != 0) {
switch (parser.next()) {
case XmlPullParser.END_TAG:
depth--;
break;
case XmlPullParser.START_TAG:
depth++;
break;
default:
// Do nothing - we're skipping content
}
}
}
示例3: readCodeFiles
private List<String> readCodeFiles(XmlPullParser parser) throws XmlPullParserException {
final List<String> result = new ArrayList<>();
try {
parser.require(XmlPullParser.START_TAG, null, CODE_FILES);
while(parser.next() != XmlPullParser.END_TAG){
if(parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
final String name = parser.getName();
if (name.equals("string")) {
result.add(readText(parser));
}
}
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
示例4: skipXmlTagParse
private void skipXmlTagParse(XmlPullParser parser) throws XmlPullParserException, IOException {
if (parser.getEventType() != XmlPullParser.START_TAG) {
throw new IllegalStateException();
}
int depth = 1;
while (depth != 0) {
switch (parser.next()) {
case XmlPullParser.END_TAG:
depth--;
break;
case XmlPullParser.START_TAG:
depth++;
break;
}
}
}
示例5: parseAndAdd
@Override
public long parseAndAdd(XmlResourceParser parser)
throws XmlPullParserException, IOException {
final String packageName = getAttributeValue(parser, ATTR_PACKAGE_NAME);
final String className = getAttributeValue(parser, ATTR_CLASS_NAME);
if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(className)) {
if (LOGD) Log.d(TAG, "Skipping invalid <appwidget> with no component");
return -1;
}
mValues.put(Favorites.SPANX, getAttributeValue(parser, ATTR_SPAN_X));
mValues.put(Favorites.SPANY, getAttributeValue(parser, ATTR_SPAN_Y));
mValues.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPWIDGET);
// Read the extras
Bundle extras = new Bundle();
int widgetDepth = parser.getDepth();
int type;
while ((type = parser.next()) != XmlPullParser.END_TAG ||
parser.getDepth() > widgetDepth) {
if (type != XmlPullParser.START_TAG) {
continue;
}
if (TAG_EXTRA.equals(parser.getName())) {
String key = getAttributeValue(parser, ATTR_KEY);
String value = getAttributeValue(parser, ATTR_VALUE);
if (key != null && value != null) {
extras.putString(key, value);
} else {
throw new RuntimeException("Widget extras must have a key and value");
}
} else {
throw new RuntimeException("Widgets can contain only extras");
}
}
return verifyAndInsert(new ComponentName(packageName, className), extras);
}
示例6: skip
private void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
if (parser.getEventType() != XmlPullParser.START_TAG) {
throw new IllegalStateException();
}
int depth = 1;
while (depth != 0) {
switch (parser.next()) {
case XmlPullParser.END_TAG:
depth--;
break;
case XmlPullParser.START_TAG:
depth++;
break;
}
}
}
示例7: skip
private void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
if (parser.getEventType() != XmlPullParser.START_TAG) {
throw new IllegalStateException();
}
int depth = 1;
while (depth != 0) {
switch (parser.next()) {
case XmlPullParser.END_TAG:
depth--;
break;
case XmlPullParser.START_TAG:
depth++;
break;
}
}
}
示例8: readExampleDefinition
private ExampleDefinition readExampleDefinition(XmlPullParser parser) throws IOException, XmlPullParserException {
parser.require(XmlPullParser.START_TAG, null, EXAMPLE_DEFINITION);
String title = "";
String iconPath = "";
String description = "";
final List<String> codeFiles = new ArrayList<>();
final List<Features> features = new ArrayList<>();
boolean isVisible = false;
while (parser.next() != XmlPullParser.END_TAG) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
final String name = parser.getName();
switch (name) {
case TITLE:
title = readElement(parser, TITLE);
break;
case ICON_PATH:
iconPath = readElement(parser, ICON_PATH);
break;
case DESCRIPTION:
description = parseDescription(readElement(parser, DESCRIPTION));
break;
case CODE_FILES:
codeFiles.addAll(readCodeFiles(parser));
break;
case FEATURES:
features.addAll(readFeatures(parser));
break;
case IS_VISIBLE:
isVisible = Boolean.parseBoolean(readElement(parser, IS_VISIBLE));
break;
default:
skip(parser);
break;
}
}
return new ExampleDefinition(title, "", "", iconPath, description, codeFiles, features, isVisible);
}
示例9: readResponse
private Response readResponse(XmlPullParser parser) throws IOException, XmlPullParserException {
Response response = new Response();
parser.require(XmlPullParser.START_TAG, ns, "response");
android.util.Log.d("PARSE", "readResponse");
while (parser.next() != XmlPullParser.END_TAG) {
android.util.Log.d("PARSE", "2eventtype=" + parser.getEventType());
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
String name = parser.getName();
android.util.Log.d("PARSE", "2name=" + name);
if (name.equals("href")) {
response.href = readText(parser);
} else if (name.equals("propstat")) {
response.propstat.add(readPropStat(parser));
} else {
skip(parser);
}
}
return response;
}
示例10: readTrkSeg
private void readTrkSeg(XmlPullParser parser) throws XmlPullParserException, IOException, ParseException {
parser.require(XmlPullParser.START_TAG, ns, "trkseg");
while (parser.next() != XmlPullParser.END_TAG) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
String name = parser.getName();
// Starts by looking for the entry tag
if (name.equals("trkpt")) {
readTrkPt(parser);
} else {
skip(parser);
}
}
}
示例11: readNameSet
private void readNameSet(@NonNull XmlPullParser parser, @NonNull FontFamily fontFamily)
throws XmlPullParserException, IOException {
while (parser.next() != XmlPullParser.END_TAG) {
if (parser.getEventType() == XmlPullParser.START_TAG && parser.getName().equals("name")) {
if (fontFamily.name == null)
fontFamily.name = readText(parser);
else {
// skip all other names
parser.next();
parser.next();
}
}
}
}
示例12: getPredefinedDeviceProfiles
ArrayList<InvariantDeviceProfile> getPredefinedDeviceProfiles(Context context) {
ArrayList<InvariantDeviceProfile> profiles = new ArrayList<>();
try (XmlResourceParser parser = context.getResources().getXml(R.xml.device_profiles)) {
final int depth = parser.getDepth();
int type;
while (((type = parser.next()) != XmlPullParser.END_TAG ||
parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
if ((type == XmlPullParser.START_TAG) && "profile".equals(parser.getName())) {
TypedArray a = context.obtainStyledAttributes(
Xml.asAttributeSet(parser), R.styleable.InvariantDeviceProfile);
int numRows = a.getInt(R.styleable.InvariantDeviceProfile_numRows, 0);
int numColumns = a.getInt(R.styleable.InvariantDeviceProfile_numColumns, 0);
float iconSize = a.getFloat(R.styleable.InvariantDeviceProfile_iconSize, 0);
profiles.add(new InvariantDeviceProfile(
a.getString(R.styleable.InvariantDeviceProfile_name),
a.getFloat(R.styleable.InvariantDeviceProfile_minWidthDps, 0),
a.getFloat(R.styleable.InvariantDeviceProfile_minHeightDps, 0),
numRows,
numColumns,
a.getInt(R.styleable.InvariantDeviceProfile_numFolderRows, numRows),
a.getInt(R.styleable.InvariantDeviceProfile_numFolderColumns, numColumns),
a.getInt(R.styleable.InvariantDeviceProfile_minAllAppsPredictionColumns, numColumns),
iconSize,
a.getFloat(R.styleable.InvariantDeviceProfile_iconTextSize, 0),
a.getInt(R.styleable.InvariantDeviceProfile_numHotseatIcons, numColumns),
a.getFloat(R.styleable.InvariantDeviceProfile_hotseatIconSize, iconSize),
a.getResourceId(R.styleable.InvariantDeviceProfile_defaultLayoutId, 0)));
a.recycle();
}
}
} catch (IOException|XmlPullParserException e) {
throw new RuntimeException(e);
}
return profiles;
}
示例13: inflateColorStateList
static ColorStateList inflateColorStateList(Context context, XmlPullParser parser, AttributeSet attrs) throws IOException, XmlPullParserException {
final int innerDepth = parser.getDepth() + 1;
int depth;
int type;
LinkedList<int[]> stateList = new LinkedList<>();
LinkedList<Integer> colorList = new LinkedList<>();
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
&& ((depth = parser.getDepth()) >= innerDepth || type != XmlPullParser.END_TAG)) {
if (type != XmlPullParser.START_TAG || depth > innerDepth
|| !parser.getName().equals("item")) {
continue;
}
TypedArray a1 = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.color});
final int value = a1.getResourceId(0, Color.MAGENTA);
final int baseColor = value == Color.MAGENTA ? Color.MAGENTA : ThemeUtils.replaceColorById(context, value);
a1.recycle();
TypedArray a2 = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.alpha});
final float alphaMod = a2.getFloat(0, 1.0f);
a2.recycle();
colorList.add(alphaMod != 1.0f
? ColorUtils.setAlphaComponent(baseColor, Math.round(Color.alpha(baseColor) * alphaMod))
: baseColor);
stateList.add(extractStateSet(attrs));
}
if (stateList.size() > 0 && stateList.size() == colorList.size()) {
int[] colors = new int[colorList.size()];
for (int i = 0; i < colorList.size(); i++) {
colors[i] = colorList.get(i);
}
return new ColorStateList(stateList.toArray(new int[stateList.size()][]), colors);
}
return null;
}
示例14: parseRecords
private static Records parseRecords(XmlPullParser xpp, @Nullable URI uri) throws IOException, XmlPullParserException {
Records records = new Records();
LayoutUtils.Stack path = new LayoutUtils.Stack(3);
push(path, xpp);
int eventType = lenientNext(xpp);
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG) {
String tag = xpp.getName();
if (LayoutUtils.isDiv(tag) && hasClass(xpp, RECORD_ITEM_CLASS)) {
Record record = parseRecord(xpp, uri);
if (record != null) {
records.add(record);
}
} else {
push(path, xpp);
}
} else if (eventType == XmlPullParser.END_TAG) {
pop(path, xpp);
if (path.isEmpty()) {
break;
}
}
eventType = lenientNext(xpp);
}
return records;
}
示例15: createAnimationFromXml
private static Animation createAnimationFromXml(Context c, XmlPullParser parser,
AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException {
Animation anim = null;
// Make sure we are on a start tag.
int type;
int depth = parser.getDepth();
while (((type=parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
&& type != XmlPullParser.END_DOCUMENT) {
if (type != XmlPullParser.START_TAG) {
continue;
}
String name = parser.getName();
if (name.equals("set")) {
anim = new AnimationSet(c, attrs);
createAnimationFromXml(c, parser, (AnimationSet)anim, attrs);
} else if (name.equals("alpha")) {
anim = new AlphaAnimation(c, attrs);
} else if (name.equals("scale")) {
anim = new ScaleAnimation(c, attrs);
} else if (name.equals("rotate")) {
anim = new RotateAnimation(c, attrs);
} else if (name.equals("translate")) {
anim = new TranslateAnimation(c, attrs);
} else {
try {
anim = (Animation) Class.forName(name).getConstructor(Context.class, AttributeSet.class).newInstance(c, attrs);
} catch (Exception te) {
throw new RuntimeException("Unknown animation name: " + parser.getName() + " error:" + te.getMessage());
}
}
if (parent != null) {
parent.addAnimation(anim);
}
}
return anim;
}