當前位置: 首頁>>代碼示例>>Java>>正文


Java XmlPullParser.getPositionDescription方法代碼示例

本文整理匯總了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;
   }
}
 
開發者ID:imkiva,項目名稱:AndroidApktool,代碼行數:23,代碼來源:XmlPullUtil.java

示例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 "";
   }
}
 
開發者ID:imkiva,項目名稱:AndroidApktool,代碼行數:26,代碼來源:XmlPullUtil.java

示例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);
    }
 
開發者ID:Pingsh,項目名稱:Mix,代碼行數:11,代碼來源:ColorStateListUtils.java

示例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);
        }
    }
}
 
開發者ID:mozilla-mobile,項目名稱:firefox-tv,代碼行數:30,代碼來源:SearchEngineParser.java

示例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());
    }
}
 
開發者ID:Microsoft,項目名稱:healthvault-java-sdk,代碼行數:17,代碼來源:XmlUtils.java

示例6: ParseException

import org.xmlpull.v1.XmlPullParser; //導入方法依賴的package包/類
public ParseException(final String msg, final XmlPullParser parser) {
    super(msg + " at " + parser.getPositionDescription());
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:4,代碼來源:XmlParseUtils.java

示例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());
   }
}
 
開發者ID:imkiva,項目名稱:AndroidApktool,代碼行數:6,代碼來源:XmlPullUtil.java

示例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());
   }
}
 
開發者ID:imkiva,項目名稱:AndroidApktool,代碼行數:6,代碼來源:XmlPullUtil.java

示例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;
    }
}
 
開發者ID:Pingsh,項目名稱:Mix,代碼行數:79,代碼來源:LayerDrawableUtils.java

示例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());
    }
}
 
開發者ID:Microsoft,項目名稱:healthvault-java-sdk,代碼行數:16,代碼來源:XmlUtils.java


注:本文中的org.xmlpull.v1.XmlPullParser.getPositionDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。