本文整理汇总了Java中org.xmlpull.v1.XmlPullParser.nextTag方法的典型用法代码示例。如果您正苦于以下问题:Java XmlPullParser.nextTag方法的具体用法?Java XmlPullParser.nextTag怎么用?Java XmlPullParser.nextTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xmlpull.v1.XmlPullParser
的用法示例。
在下文中一共展示了XmlPullParser.nextTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: readText
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private String readText(XmlPullParser parser) throws IOException, XmlPullParserException {
String result = "";
if (parser.next() == XmlPullParser.TEXT) {
result = parser.getText();
parser.nextTag();
}
return result;
}
示例3: readText
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private String readText(@NonNull XmlPullParser parser) throws IOException, XmlPullParserException {
String result = "";
if (parser.next() == XmlPullParser.TEXT) {
result = parser.getText();
parser.nextTag();
}
return result;
}
示例4: readText
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/**
* reads a String value from xml tag
*
* @param parser
* @return
* @throws IOException
* @throws XmlPullParserException
*/
private String readText(XmlPullParser parser) throws IOException, XmlPullParserException {
String result = "";
if (parser.next() == XmlPullParser.TEXT) {
result = parser.getText();
parser.nextTag();
}
return result;
}
示例5: getText
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private static String getText(final XmlPullParser parser) throws XmlPullParserException,
IOException {
if (parser.next() == XmlPullParser.TEXT) {
final String text = parser.getText();
parser.nextTag();
return text;
}
return null;
}
示例6: readMethodCall
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public MethodCall readMethodCall(Socket socket) throws IOException, XmlPullParserException
{
MethodCall methodCall = new MethodCall();
InputStream inputStream = socket.getInputStream();
XmlPullParser pullParser = xmlPullParserFromSocket(inputStream);
pullParser.nextTag();
pullParser.require(XmlPullParser.START_TAG, null, Tag.METHOD_CALL);
pullParser.nextTag();
pullParser.require(XmlPullParser.START_TAG, null, Tag.METHOD_NAME);
methodCall.setMethodName(pullParser.nextText());
pullParser.nextTag();
pullParser.require(XmlPullParser.START_TAG, null, Tag.PARAMS);
pullParser.nextTag(); // <param>
do {
//Log.d(Tag.LOG, "type=" + pullParser.getEventType() + ", tag=" + pullParser.getName());
pullParser.require(XmlPullParser.START_TAG, null, Tag.PARAM);
pullParser.nextTag(); // <value>
Object param = iXMLRPCSerializer.deserialize(pullParser);
methodCall.params.add(param); // add to return value
pullParser.nextTag();
pullParser.require(XmlPullParser.END_TAG, null, Tag.PARAM);
pullParser.nextTag(); // <param> or </params>
} while (!pullParser.getName().equals(Tag.PARAMS)); // </params>
return methodCall;
}
示例7: readText
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static String readText(XmlPullParser parser)
throws IOException, XmlPullParserException {
String result = "";
if (parser.next() == XmlPullParser.TEXT) {
result = parser.getText();
parser.nextTag();
}
return result;
}
示例8: 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);
}
}
示例9: readTextValue
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static String readTextValue(XmlPullParser parser, String tag, String namespace) throws IOException, XmlPullParserException {
String result = "";
parser.require(XmlPullParser.START_TAG, namespace, tag);
if (parser.next() == XmlPullParser.TEXT) {
result = parser.getText();
parser.nextTag();
}
parser.require(XmlPullParser.END_TAG, namespace, tag);
return result;
}
示例10: parse
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public DialService parse(Reader xml) throws DialException {
try {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser parser = factory.newPullParser();
parser.setInput(xml);
parser.nextTag();
return readService(parser);
} catch(XmlPullParserException | IOException e) {
throw new DialException(e);
}
}
示例11: 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);
}
}
示例12: readUrl
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
private static void readUrl(XmlPullParser parser, SearchEngine searchEngine) throws XmlPullParserException, IOException {
parser.require(XmlPullParser.START_TAG, null, "Url");
final String type = parser.getAttributeValue(null, "type");
final String template = parser.getAttributeValue(null, "template");
final String rel = parser.getAttributeValue(null, "rel");
Uri uri = Uri.parse(template);
while (parser.next() != XmlPullParser.END_TAG) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
final String tag = parser.getName();
if (tag.equals("Param")) {
final String name = parser.getAttributeValue(null, "name");
final String value = parser.getAttributeValue(null, "value");
uri = uri.buildUpon().appendQueryParameter(name, value).build();
parser.nextTag();
} else {
skip(parser);
}
}
if (type.equals(URLTYPE_SEARCH_HTML)) {
// Prefer mobile URIs.
if (rel != null && rel.equals(URL_REL_MOBILE)) {
searchEngine.resultsUris.add(0, uri);
} else {
searchEngine.resultsUris.add(uri);
}
} else if (type.equals(URLTYPE_SUGGEST_JSON)) {
searchEngine.suggestUri = uri;
}
}
示例13: load
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/***
* Public method that loads settings values from XML file
* @throws XmlPullParserException
* @throws IOException
*/
public void load() throws XmlPullParserException, IOException {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser parser = factory.newPullParser();
parser.setInput(new StringReader(getFileContent(URI)));
parser.nextTag();
settings = readFeed(parser);
}
示例14: readText
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
/***
* Private method that read text into tags of any kind inside XML file
* @param parser the current parser used to parse the XML file
* @return String that contains the text of the current tag
* @throws IOException
* @throws XmlPullParserException
*/
private String readText(XmlPullParser parser) throws IOException, XmlPullParserException {
String result = "";
if (parser.next() == XmlPullParser.TEXT) {
result = parser.getText();
parser.nextTag();
}
return result;
}
示例15: parse
import org.xmlpull.v1.XmlPullParser; //导入方法依赖的package包/类
public static void parse(final InputStream in, final OPMLFile file) throws OPMLParserException,
XmlPullParserException,
IOException {
final XmlPullParser parser = Xml.newPullParser();
parser.setInput(in, null);
if (isInputEncodingUnsupported(parser)) {
parserInvalidDocument(parser);
}
parser.nextTag();
if (parser.getAttributeCount() != 1) {
parserInvalidDocument(parser);
}
final String version = parser.getAttributeValue(0);
if (!version.equals(OPML_1_0) && !version.equals(OPML_1_1) && !version.equals(OPML_2_0)) {
parserInvalidDocument(parser);
}
parseOPML(parser, file, version);
in.close();
}