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


Java XmlPullParser.TEXT屬性代碼示例

本文整理匯總了Java中org.xmlpull.v1.XmlPullParser.TEXT屬性的典型用法代碼示例。如果您正苦於以下問題:Java XmlPullParser.TEXT屬性的具體用法?Java XmlPullParser.TEXT怎麽用?Java XmlPullParser.TEXT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.xmlpull.v1.XmlPullParser的用法示例。


在下文中一共展示了XmlPullParser.TEXT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseManifest

/**
 * parseManifest
 *
 * @param parser        parser
 * @param intentFilters intentFilters
 * @throws Exception e
 */
private static void parseManifest(XmlResourceParser parser, Map<String, IntentFilter> intentFilters)
        throws Exception {
    int outerDepth = parser.getDepth();
    int type;
    while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
            && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
        if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
            continue;
        }
        String tagName = parser.getName();
        if (tagName == null) {
            continue;
        }
        if (tagName.equals("activity") || tagName.equals("receiver") || tagName.equals("service")) {
            String activityName = parser.getAttributeValue(ANDROID_RESOURCES, "name");
            if (activityName != null) {
                parseActivity(activityName, intentFilters, parser);
            }
        }
    }
}
 
開發者ID:LiangMaYong,項目名稱:android-apkbox,代碼行數:28,代碼來源:ApkManifestParser.java

示例2: readImage

private static void readImage(XmlPullParser parser, SearchEngine searchEngine) throws IOException, XmlPullParserException {
    parser.require(XmlPullParser.START_TAG, null, "Image");

    if (parser.next() != XmlPullParser.TEXT) {
        return;
    }

    final String uri = parser.getText();
    if (!uri.startsWith(IMAGE_URI_PREFIX)) {
        return;
    }

    final byte[] raw = Base64.decode(uri.substring(IMAGE_URI_PREFIX.length()), Base64.DEFAULT);

    searchEngine.icon = BitmapFactory.decodeByteArray(raw, 0, raw.length);

    parser.nextTag();
}
 
開發者ID:mozilla-mobile,項目名稱:firefox-tv,代碼行數:18,代碼來源:SearchEngineParser.java

示例3: doWork

public void doWork(XmlPullParser reader, XMLWriter writer)
	throws Exception
{
	// Deal with the contents of the tag
	int eventType = reader.getEventType();
	while (eventType != XmlPullParser.END_TAG) 
       {
		eventType = reader.next();
		if (eventType == XmlPullParser.START_TAG) 
		{
			ImportFileUpdater.this.outputCurrentElement(reader, writer, new OutputChildren());
		}
		else if (eventType == XmlPullParser.TEXT)
		{
			// Write the text to the output file
			writer.write(reader.getText());
		}
       }			
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:19,代碼來源:ImportFileUpdater.java

示例4: parseContentProtection

/**
 * Parses a {@link ContentProtection} element.
 *
 * @throws XmlPullParserException If an error occurs parsing the element.
 * @throws IOException If an error occurs reading the element.
 * @return The parsed {@link ContentProtection} element, or null if the element is unsupported.
 **/
protected ContentProtection parseContentProtection(XmlPullParser xpp)
    throws XmlPullParserException, IOException {
  String schemeIdUri = xpp.getAttributeValue(null, "schemeIdUri");
  UUID uuid = null;
  SchemeInitData data = null;
  boolean seenPsshElement = false;
  do {
    xpp.next();
    // The cenc:pssh element is defined in 23001-7:2015.
    if (ParserUtil.isStartTag(xpp, "cenc:pssh") && xpp.next() == XmlPullParser.TEXT) {
      seenPsshElement = true;
      data = new SchemeInitData(MimeTypes.VIDEO_MP4,
          Base64.decode(xpp.getText(), Base64.DEFAULT));
      uuid = PsshAtomUtil.parseUuid(data.data);
    }
  } while (!ParserUtil.isEndTag(xpp, "ContentProtection"));
  if (seenPsshElement && uuid == null) {
    Log.w(TAG, "Skipped unsupported ContentProtection element");
    return null;
  }
  return buildContentProtection(schemeIdUri, uuid, data);
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:29,代碼來源:MediaPresentationDescriptionParser.java

示例5: gatherValuesForTagName

private static void gatherValuesForTagName(String tagName, Reader xml, StringBuilder gatherer, int maxSize)
	throws XmlPullParserException, IOException
{
	XmlPullParser parser = new MXParser();
	parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
	parser.setInput(xml);

	int event = parser.getEventType();
	while( event != XmlPullParser.END_DOCUMENT )
	{
		if( event == XmlPullParser.START_TAG && parser.getName().equals(tagName) )
		{
			while( parser.next() == XmlPullParser.TEXT )
			{
				String s = parser.getText();
				if( s != null )
				{
					// Removal all tabs, newlines, returns, etc.. and trim
					// white space
					s = s.replaceAll("\\cM?\r?\r\n\t", "").trim();
					if( s.length() > 0 )
					{
						gatherer.append(s);
						gatherer.append(' ');
					}
				}
			}

			if( gatherer.length() >= maxSize )
			{
				return;
			}
		}
		event = parser.next();
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:36,代碼來源:AbstractOffice2007Extracter.java

示例6: next

protected NodeEvent next() throws XmlPullParserException, IOException
{
	if( playback )
	{
		playbackIndex++;
		current = history.get(playbackIndex);
	}
	else
	{
		int code = parser.next();
		NodeEvent event = new NodeEvent();
		event.status = code;
		if( code == XmlPullParser.START_TAG )
		{
			event.name = parser.getName();
			@SuppressWarnings("unchecked")
			Pair<String, String>[] convenientDevice = new Pair[parser.getAttributeCount()];
			event.attributes = convenientDevice;
			for( int i = 0; i < event.attributes.length; i++ )
			{
				Pair<String, String> attr = new Pair<String, String>(parser.getAttributeName(i),
					parser.getAttributeValue(i));
				event.attributes[i] = attr;
			}
		}
		else if( code == XmlPullParser.TEXT )
		{
			event.whitespace = parser.isWhitespace();
			event.text = parser.getText();
		}
		if( recording )
		{
			history.add(event);
		}
		current = event;
	}
	return current;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:38,代碼來源:XPathMapper.java

示例7: parse

/**
 * xml解析為對象
 *
 * @param text
 * @return
 */
public static GradleDependencyEntity parse(String text) {
    GradleDependencyEntity entity = new GradleDependencyEntity();
    XmlPullParserFactory f = null;
    try {
        f = XmlPullParserFactory.newInstance();
        f.setNamespaceAware(true);
        XmlPullParser xmlPullParser = f.newPullParser();
        xmlPullParser.setInput(new InputStreamReader(new ByteArrayInputStream(text.getBytes())));
        int eventType = xmlPullParser.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            if (eventType == XmlPullParser.START_DOCUMENT) {

            } else if (eventType == XmlPullParser.START_TAG) {
                String name = xmlPullParser.getName();
                if (name.equals("groupId")) {
                    entity.setGroupId(xmlPullParser.nextText());
                } else if (name.equals("artifactId")) {
                    entity.setArtifactId(xmlPullParser.nextText());
                } else if (name.equals("version")) {
                    String version = xmlPullParser.nextText();
                    entity.setVersion(version);
                } else if (name.equals("lastUpdated")) {
                    entity.setUpdateTime(xmlPullParser.nextText());
                }
            } else if (eventType == XmlPullParser.END_TAG) {

            } else if (eventType == XmlPullParser.TEXT) {

            }
            eventType = xmlPullParser.next();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return entity;
}
 
開發者ID:beansoftapp,項目名稱:react-native-console,代碼行數:42,代碼來源:GradleDependencyEntity.java

示例8: readText

private String readText(XmlPullParser parser) throws IOException, XmlPullParserException {
    String result = "";
    if (parser.next() == XmlPullParser.TEXT) {
        result = parser.getText();
        parser.nextTag();
    }
    android.util.Log.d("PARSE", "read text " + result);
    return result;
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:9,代碼來源:PropfindXmlParser.java

示例9: readText

public static String readText(XmlPullParser parser) throws Exception
{
    String result = "";
    if (parser.next() == XmlPullParser.TEXT)
    {
        result = parser.getText();
        parser.nextTag();
    }
    return result;
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:10,代碼來源:XmlUtils.java

示例10: readInt

private int readInt(XmlPullParser parser) throws IOException, XmlPullParserException {
    String result = "";
    if (parser.next() == XmlPullParser.TEXT) {
        result = parser.getText();
        parser.nextTag();
    }
    return Integer.valueOf(result);
}
 
開發者ID:5GSD,項目名稱:AIMSICDL,代碼行數:8,代碼來源:StackOverflowXmlParser.java

示例11: readXmlElementText

private String readXmlElementText(XmlPullParser parser) throws IOException, XmlPullParserException {
    String result = "";
    if (parser.next() == XmlPullParser.TEXT) {
        result = parser.getText();
        parser.nextTag();
    }
    if (result != null && !result.isEmpty()) {
        result = result.trim();
    }
    return result;
}
 
開發者ID:malah-code,項目名稱:Open-Quran-Radio,代碼行數:11,代碼來源:Station.java

示例12: getTag

private String getTag(String tag, String source) {
    try {
        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware(true);
        XmlPullParser xmlPullParser = factory.newPullParser();
        xmlPullParser.setInput(new StringReader(source));

        xmlPullParser.next();
        int eventType = xmlPullParser.getEventType();

        String content = null;
        boolean shouldRead = false;
        while (eventType != XmlPullParser.END_DOCUMENT) {
            switch (eventType) {
                case XmlPullParser.START_TAG:
                    if (xmlPullParser.getName().equals(tag)) {
                        shouldRead = true;
                    }
                    break;
                case XmlPullParser.TEXT:
                    if (shouldRead) {
                        content = xmlPullParser.getText();
                    }
                    break;
                case XmlPullParser.END_TAG:
                    shouldRead = false;
                    break;
            }
            eventType = xmlPullParser.next();
        }
        return content;
    } catch (IOException | XmlPullParserException e) {
        Timber.i("", e);
    }
    return null;
}
 
開發者ID:mecid,項目名稱:robird-reborn,代碼行數:36,代碼來源:TweetLongerUtils.java

示例13: readText

private String readText(XmlPullParser parser) throws IOException, XmlPullParserException {
    String result = "";
    if (parser.next() == XmlPullParser.TEXT) {
        result = parser.getText();
        parser.nextTag();
    }
    return result;
}
 
開發者ID:dkarivalis,項目名稱:SWGEmuServerStatus,代碼行數:8,代碼來源:ZoneServerXmlParser.java

示例14: readLong

private Long readLong(XmlPullParser parser) throws IOException, XmlPullParserException {
    Long result = null;
    if (parser.next() == XmlPullParser.TEXT) {
        final String text = parser.getText();
        if (text != null && !text.isEmpty()) {
            result = Long.valueOf(text);
        }
        parser.nextTag();
    }
    return result;
}
 
開發者ID:dkarivalis,項目名稱:SWGEmuServerStatus,代碼行數:11,代碼來源:ZoneServerXmlParser.java

示例15: readText

private String readText(@NonNull XmlPullParser parser)
        throws IOException, XmlPullParserException {
    String text = "";
    if (parser.next() == XmlPullParser.TEXT) {
        text = parser.getText();
        parser.next();
    }
    return text;
}
 
開發者ID:olgamiller,項目名稱:SSTVEncoder2,代碼行數:9,代碼來源:FontFamilySet.java


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