當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。