本文整理汇总了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;
}