当前位置: 首页>>代码示例>>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;未经允许,请勿转载。