当前位置: 首页>>代码示例>>Java>>正文


Java XmlPullParser.setFeature方法代码示例

本文整理汇总了Java中org.xmlpull.v1.XmlPullParser.setFeature方法的典型用法代码示例。如果您正苦于以下问题:Java XmlPullParser.setFeature方法的具体用法?Java XmlPullParser.setFeature怎么用?Java XmlPullParser.setFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xmlpull.v1.XmlPullParser的用法示例。


在下文中一共展示了XmlPullParser.setFeature方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public List<RssItem> Parse(@NonNull InputStream inputStream) throws XmlPullParserException, IOException {
    try {
        XmlPullParser parser = Xml.newPullParser();

        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(inputStream, null);
        parser.nextTag();

        return readFeed(parser);
    } catch (Exception exception) {
        Logger.getInstance().Error(TAG, exception.getMessage());
    } finally {
        inputStream.close();
    }

    return null;
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:18,代码来源:RssParser.java

示例2: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
@NonNull
ArrayList<RssItem> parse(String stream) {
    ArrayList<RssItem> items = null;
    try {
        XmlPullParser parser = Xml.newPullParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(new StringReader(stream));
        parser.nextTag();
        parser.require(XmlPullParser.START_TAG, null, TAG_RSS);
        items = readFeed(parser);
    } catch (@NonNull XmlPullParserException | IOException e) {
        Log.w(e.getMessage(), e);
    } finally {
        if (items == null) {
            items = new ArrayList<>();
        }
    }
    return items;
}
 
开发者ID:MBach,项目名称:LeMondeRssReader,代码行数:20,代码来源:RssParser.java

示例3: Parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public List<RssItem> Parse(@NonNull InputStream inputStream) throws XmlPullParserException, IOException {
    try {
        XmlPullParser parser = Xml.newPullParser();

        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(inputStream, null);
        parser.nextTag();

        return readFeed(parser);
    } catch (Exception exception) {
        new SmartMirrorLogger(TAG).Error(exception.getMessage());
    } finally {
        inputStream.close();
    }

    return null;
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:18,代码来源:RssParser.java

示例4: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public List<Response> parse(Reader in) throws XmlPullParserException, IOException {
    List<Response> responses = new ArrayList<Response>();

    XmlPullParser parser = Xml.newPullParser();

    parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES,true);
    parser.setInput(in);
    parser.nextTag();

    parser.require(XmlPullParser.START_TAG, ns, "multistatus");


    while (parser.next() != XmlPullParser.END_TAG) {
        android.util.Log.d("PARSE", "1eventtype=" + parser.getEventType());

        if (parser.getEventType() != XmlPullParser.START_TAG) {
            continue;
        }
        String name = parser.getName();

        android.util.Log.d("PARSE", "1name = " + name);

        // Starts by looking for the entry tag
        if (name.equals("response")) {
            responses.add(readResponse(parser));
        } else {
            skip(parser);
        }
    }


    return responses;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:34,代码来源:PropfindXmlParser.java

示例5: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public List<Cell> parse(InputStream in) throws XmlPullParserException, IOException {
    try {
        XmlPullParser parser = Xml.newPullParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(in, null);
        parser.nextTag();
        return readCells(parser);
    } finally {
        in.close();
    }
}
 
开发者ID:5GSD,项目名称:AIMSICDL,代码行数:12,代码来源:StackOverflowXmlParser.java

示例6: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
ZoneServer parse(final InputStream in) throws XmlPullParserException, IOException {
    try {
        XmlPullParser parser = Xml.newPullParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(in, null);
        parser.nextTag();
        return readZoneServer(parser);
    } finally {
        in.close();
    }
}
 
开发者ID:dkarivalis,项目名称:SWGEmuServerStatus,代码行数:12,代码来源:ZoneServerXmlParser.java

示例7: gatherValuesForTagName

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
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,代码行数:37,代码来源:AbstractOffice2007Extracter.java

示例8: getScormVersion

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static String getScormVersion(Reader xml, boolean alwaysReturnDefaultVersion) throws XmlPullParserException,
	IOException
{
	XmlPullParser parser = new MXParser();
	parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
	parser.setInput(xml);

	parser.next();
	String namespace = parser.getNamespace("adlcp");
	String version = null;
	if( namespace != null )
	{
		if( namespace.equals("http://www.adlnet.org/xsd/adlcp_rootv1p2") )
		{
			version = "1.2";
		}
		else if( namespace.equals("http://www.adlnet.org/xsd/adlcp_v1p3") )
		{
			version = "1.3";
		}
		else if( alwaysReturnDefaultVersion )
		{
			version = "1.2";
		}
	}
	return version;
}
 
开发者ID:equella,项目名称:Equella,代码行数:28,代码来源:IMSUtilities.java

示例9: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public List<Entry> parse(InputStream in) throws XmlPullParserException, IOException {
    try {
        XmlPullParser parser = Xml.newPullParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(in, null);
        parser.nextTag();
        return readFeed(parser);
    } finally {
        in.close();
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:12,代码来源:StackOverflowXmlParser.java

示例10: loadStringsFromResourceFile

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private static void loadStringsFromResourceFile() {
    try {
        Resources res = UOctubreApplication.getInstance().getResources();
        InputStream in = res.getAssets().open("strings_" + currentLanguage + ".xml");
        XmlPullParser parser = Xml.newPullParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(in, null);
        parser.nextTag();
        readStrings(parser);
        in.close();

    } catch (XmlPullParserException | IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:16,代码来源:StringsManager.java

示例11: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private LocSample[] parse() throws XmlPullParserException, IOException {
    File f = new File(m_uri.getPath());
    try (FileInputStream s = new FileInputStream(f)){
        XmlPullParser parser = Xml.newPullParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(s, null);
        parser.nextTag();
        return readFeed(parser);
    }
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:11,代码来源:Telemetry.java

示例12: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public OTADevice parse(InputStream in, String deviceName, String releaseType) throws XmlPullParserException, IOException {
    this.mDeviceName = deviceName;
    this.mReleaseType = releaseType;

    try {
        XmlPullParser parser = Xml.newPullParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(in, null);
        parser.nextTag();
        readBuildType(parser);
        return mDevice;
    } finally {
        in.close();
    }
}
 
开发者ID:DroidThug,项目名称:VulcanOTA,代码行数:16,代码来源:OTAParser.java

示例13: parse

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public List parse(InputStream in) throws XmlPullParserException, IOException {
    try {
        XmlPullParser parser = Xml.newPullParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
        parser.setInput(in, null);
        parser.nextTag();
        return readFeed(parser);
    } finally {
        in.close();
    }
}
 
开发者ID:Recipe4Meals,项目名称:BLG-411E,代码行数:12,代码来源:IngredientsXMLParser.java

示例14: getValueForPath

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/**
 * Retrieves the value of an XPath from an XML stream.
 */
private static String getValueForPath(String xpath, Reader xml) throws XmlPullParserException, IOException
{
	XmlPullParser parser = new MXParser();
	parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
	parser.setInput(xml);

	int depth = 1;
	String[] splits = xpath.split("/");

	int event = parser.getEventType();
	while( event != XmlPullParser.END_DOCUMENT )
	{
		if( event == XmlPullParser.START_TAG && parser.getDepth() == depth )
		{
			String[] elemNames = splits[depth - 1].split("\\|");
			for( int i = 0; i < elemNames.length; i++ )
			{
				if( parser.getName().equals(elemNames[i]) )
				{
					if( depth == splits.length )
					{
						if( parser.next() == XmlPullParser.TEXT )
						{
							return parser.getText();
						}
						else
						{
							return null;
						}
					}
					else
					{
						depth++;
					}
				}
			}
		}
		event = parser.next();
	}

	return null;
}
 
开发者ID:equella,项目名称:Equella,代码行数:46,代码来源:IMSUtilities.java

示例15: parsiElsendojnDeRssVinilkosmo

import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/** Parser et youtube RSS feed og returnerer det som en liste at Elsendo-objekter */
private static ArrayList<Udsendelse> parsiElsendojnDeRssVinilkosmo(Reader is) throws Exception {
  XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
  XmlPullParser p = factory.newPullParser();
  p.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
  p.setInput(is);
  ArrayList<Udsendelse> liste = new ArrayList<Udsendelse>();
  Udsendelse e = null;
  while (true) {
    int eventType = p.next();
    if (eventType == XmlPullParser.END_DOCUMENT) {
      break;
    }
    if (eventType != XmlPullParser.START_TAG) {
      continue;
    }
    String ns = p.getPrefix(); // namespace
    String tag = p.getName();
    //System.out.println("<" + ns + ":" + tag + ">");

    if ("entry".equals(tag)) {
      if (e != null && e.sonoUrl.size()>0) liste.add(e);
      e = new Udsendelse();
    } else if (e == null) {
      continue;
    } else if ("title".equals(tag)) {
      e.titel = EoDiverse.unescapeHtml3(p.nextText());
    } else if ("published".equals(tag)) {
      String txt = p.nextText();
      e.startTidKl = txt.split("T")[0];
      //Log.d("e.datoStr="+e.datoStr);
      e.startTid = EsperantoRadioBackend.datoformato.parse(e.startTidKl);
      e.startTidKl = EsperantoRadioBackend.datoformato.format(e.startTid);
      e.slug = "vk:"+txt.split("\\+")[0];
    } else if ("link".equals(tag)) {
      String type = p.getAttributeValue(null, "type");
      String href = p.getAttributeValue(null, "href");
      if ("audio/mpeg".equals(type)) {
        e.sonoUrl.add(href);
      } else if ("image/jpeg".equals(type) && e.billedeUrl ==null) {
        e.billedeUrl =href;
      } else if ("text/html".equals(type)) {
        e.shareLink =href;
      }
    } else if ("content".equals(tag)) {
      e.beskrivelse = p.nextText().trim();
      e.beskrivelse = puriguVinilkosmo.matcher(e.beskrivelse).replaceAll("");
      while (e.beskrivelse.startsWith("<p>")) e.beskrivelse = e.beskrivelse.substring(3).trim();
      while (e.beskrivelse.startsWith("</div>")) e.beskrivelse = e.beskrivelse.substring(6).trim();
    }
  }
  if (e != null && e.sonoUrl.size()>0) liste.add(e);
  is.close();
  return liste;
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:56,代码来源:EoRssParsado.java


注:本文中的org.xmlpull.v1.XmlPullParser.setFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。