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