本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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;
}