本文整理汇总了Java中org.xmlpull.v1.XmlPullParser.getPositionDescription方法的典型用法代码示例。如果您正苦于以下问题:Java XmlPullParser.getPositionDescription方法的具体用法?Java XmlPullParser.getPositionDescription怎么用?Java XmlPullParser.getPositionDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xmlpull.v1.XmlPullParser
的用法示例。
在下文中一共展示了XmlPullParser.getPositionDescription方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPITarget
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static String getPITarget(XmlPullParser var0) throws IllegalStateException {
int var1;
try {
var1 = var0.getEventType();
} catch (XmlPullParserException var4) {
throw new IllegalStateException("could not determine parser state: " + var4 + var0.getPositionDescription());
}
if(var1 != 8) {
throw new IllegalStateException("parser must be on processing instruction and not " + XmlPullParser.TYPES[var1] + var0.getPositionDescription());
} else {
String var2 = var0.getText();
for(int var3 = 0; var3 < var2.length(); ++var3) {
if(isS(var2.charAt(var3))) {
return var2.substring(0, var3);
}
}
return var2;
}
}
示例2: getPIData
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static String getPIData(XmlPullParser var0) throws IllegalStateException {
int var1;
try {
var1 = var0.getEventType();
} catch (XmlPullParserException var5) {
throw new IllegalStateException("could not determine parser state: " + var5 + var0.getPositionDescription());
}
if(var1 != 8) {
throw new IllegalStateException("parser must be on processing instruction and not " + XmlPullParser.TYPES[var1] + var0.getPositionDescription());
} else {
String var2 = var0.getText();
int var3 = -1;
for(int var4 = 0; var4 < var2.length(); ++var4) {
if(isS(var2.charAt(var4))) {
var3 = var4;
} else if(var3 > 0) {
return var2.substring(var4);
}
}
return "";
}
}
示例3: createFromXmlInner
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
static ColorStateList createFromXmlInner(Context context, XmlPullParser parser, AttributeSet attrs) throws IOException, XmlPullParserException {
final String name = parser.getName();
if (!name.equals("selector")) {
throw new XmlPullParserException(
parser.getPositionDescription() + ": invalid color state list tag " + name);
}
return inflateColorStateList(context, parser, attrs);
}
示例4: readSearchPlugin
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private static void readSearchPlugin(XmlPullParser parser, SearchEngine searchEngine) throws XmlPullParserException, IOException {
if (XmlPullParser.START_TAG != parser.getEventType()) {
throw new XmlPullParserException("Expected start tag: " + parser.getPositionDescription());
}
final String name = parser.getName();
if (!"SearchPlugin".equals(name) && !"OpenSearchDescription".equals(name)) {
throw new XmlPullParserException("Expected <SearchPlugin> or <OpenSearchDescription> as root tag: "
+ parser.getPositionDescription());
}
while (parser.next() != XmlPullParser.END_TAG) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
final String tag = parser.getName();
if (tag.equals("ShortName")) {
readShortName(parser, searchEngine);
} else if (tag.equals("Url")) {
readUrl(parser, searchEngine);
} else if (tag.equals("Image")) {
readImage(parser, searchEngine);
} else {
skip(parser);
}
}
}
示例5: nextStartTag
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/**
* Next start tag.
*
* @param parser the parser
*
* @throws XmlPullParserException the xml pull parser exception
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void nextStartTag(XmlPullParser parser)
throws XmlPullParserException, IOException
{
if (parser.nextTag() != XmlPullParser.START_TAG) {
throw new XmlPullParserException(
"expected START_TAG but found: " + parser.getPositionDescription());
}
}
示例6: ParseException
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public ParseException(final String msg, final XmlPullParser parser) {
super(msg + " at " + parser.getPositionDescription());
}
示例7: nextStartTag
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static void nextStartTag(XmlPullParser var0) throws XmlPullParserException, IOException {
if(var0.nextTag() != 2) {
throw new XmlPullParserException("expected START_TAG and not " + var0.getPositionDescription());
}
}
示例8: nextEndTag
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static void nextEndTag(XmlPullParser var0) throws XmlPullParserException, IOException {
if(var0.nextTag() != 3) {
throw new XmlPullParserException("expected END_TAG and not" + var0.getPositionDescription());
}
}
示例9: inflateDrawable
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
@Override
protected Drawable inflateDrawable(Context context, XmlPullParser parser, AttributeSet attrs) throws IOException, XmlPullParserException {
final int innerDepth = parser.getDepth() + 1;
int type;
int depth;
int layerAttrUseCount = 0;
int drawableUseCount = 0;
int space = STEP << 1;
//L,T,R,B,S,E,id
int[][] childLayersAttrs = new int[space][ATTRS.length];
Drawable[] drawables = new Drawable[space];
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
&& ((depth = parser.getDepth()) >= innerDepth || type != XmlPullParser.END_TAG)) {
if (type != XmlPullParser.START_TAG) {
continue;
}
if (depth > innerDepth || !parser.getName().equals("item")) {
continue;
}
if (layerAttrUseCount >= childLayersAttrs.length) {
int[][] dstInt = new int[drawables.length + STEP][ATTRS.length];
System.arraycopy(childLayersAttrs, 0, dstInt, 0, childLayersAttrs.length);
childLayersAttrs = dstInt;
}
updateLayerAttrs(context, attrs, childLayersAttrs[layerAttrUseCount]);
layerAttrUseCount++;
Drawable drawable = getAttrDrawable(context, attrs, android.R.attr.drawable);
// If the layer doesn't have a drawable or unresolved theme
// attribute for a drawable, attempt to parse one from the child
// element.
if (drawable == null) {
while ((type = parser.next()) == XmlPullParser.TEXT) {
}
if (type != XmlPullParser.START_TAG) {
throw new XmlPullParserException(parser.getPositionDescription()
+ ": <item> tag requires a 'drawable' attribute or "
+ "child tag defining a drawable");
}
drawable = createFromXmlInner(context, parser, attrs);
} else {
final ColorStateList cls = getTintColorList(context, attrs, R.attr.drawableTint);
if (cls != null) {
drawable = ThemeUtils.tintDrawable(drawable, cls, getTintMode(context, attrs, R.attr.drawableTintMode));
}
}
if (drawable != null) {
if (drawableUseCount >= drawables.length) {
Drawable[] dst = new Drawable[drawables.length + STEP];
System.arraycopy(drawables, 0, dst, 0, drawables.length);
drawables = dst;
}
drawables[drawableUseCount] = drawable;
drawableUseCount++;
}
}
if (drawables[0] == null || drawableUseCount != layerAttrUseCount) {
return null;
} else {
LayerDrawable layerDrawable = new LayerDrawable(drawables);
for (int i = 0; i < drawables.length; i++) {
int[] childLayersAttr = childLayersAttrs[i];
if (childLayersAttr[0] != 0 || childLayersAttr[1] != 0 || childLayersAttr[2] != 0 || childLayersAttr[3] != 0) {
layerDrawable.setLayerInset(i, childLayersAttr[0], childLayersAttr[1], childLayersAttr[2], childLayersAttr[3]);
}
if (childLayersAttr[4] != 0) {
layerDrawable.setId(i, childLayersAttr[4]);
}
}
return layerDrawable;
}
}
示例10: nextEndTag
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/**
* Call parser nextTag() and check that it is END_TAG, throw exception if not.
*
* @param parser the parser
*
* @throws XmlPullParserException the xml pull parser exception
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void nextEndTag(XmlPullParser parser) throws XmlPullParserException, IOException
{
if (parser.nextTag() != XmlPullParser.END_TAG) {
throw new XmlPullParserException(
"expected END_TAG and not"+parser.getPositionDescription());
}
}