本文整理汇总了Java中org.xmlpull.mxp1.MXParser.next方法的典型用法代码示例。如果您正苦于以下问题:Java MXParser.next方法的具体用法?Java MXParser.next怎么用?Java MXParser.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xmlpull.mxp1.MXParser
的用法示例。
在下文中一共展示了MXParser.next方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTranscript
import org.xmlpull.mxp1.MXParser; //导入方法依赖的package包/类
/**
* Reads in the transcript file using the Xml Pull Parser.
*
* @param transcriptFile the transcript file to read.
* @return the ChatTranscript.
*/
public static ChatTranscript getTranscript(File transcriptFile) {
final ChatTranscript transcript = new ChatTranscript();
if (!transcriptFile.exists()) {
return transcript;
}
try {
final MXParser parser = new MXParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(transcriptFile), "UTF-8"));
parser.setInput(in);
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG && "message".equals(parser.getName())) {
transcript.addHistoryMessage(getHistoryMessage(parser));
}
else if (eventType == XmlPullParser.END_TAG && "transcript".equals(parser.getName())) {
done = true;
}
}
}
catch (Exception e) {
e.printStackTrace();
}
return transcript;
}
示例2: loadPreviousHistory
import org.xmlpull.mxp1.MXParser; //导入方法依赖的package包/类
/**
* Loads the previous history.
*/
private void loadPreviousHistory() {
if (!conFile.exists()) {
return;
}
// Otherwise load it.
try {
final MXParser parser = new MXParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(conFile), "UTF-8"));
parser.setInput(in);
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG && "user".equals(parser.getName())) {
String jid = StringUtils.parseBareAddress(parser.nextText());
historyList.add(jid);
}
else if (eventType == XmlPullParser.END_TAG && "conversations".equals(parser.getName())) {
done = true;
}
}
}
catch (Exception e) {
Log.error(e);
}
}
示例3: loadPhonebook
import org.xmlpull.mxp1.MXParser; //导入方法依赖的package包/类
/**
* Reads in the transcript file using the Xml Pull Parser.
*/
private void loadPhonebook() {
File bookFile = getPhonebookFile();
if (!bookFile.exists()) {
return;
}
// Otherwise load
try {
final MXParser parser = new MXParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(bookFile), "UTF-8"));
parser.setInput(in);
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG && "entry".equals(parser.getName())) {
phonenumbers.add(getBookEntry(parser));
}
else if (eventType == XmlPullParser.END_TAG && "book".equals(parser.getName())) {
done = true;
}
}
}
catch (Exception e) {
Log.error(e);
}
}
示例4: loadCallHistory
import org.xmlpull.mxp1.MXParser; //导入方法依赖的package包/类
/**
* Reads in the transcript file using the Xml Pull Parser.
*/
private void loadCallHistory() {
File historyFile = getHistoryFile();
if (!historyFile.exists()) {
return;
}
// Otherwise load
try {
final MXParser parser = new MXParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(historyFile), "UTF-8"));
parser.setInput(in);
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG && "call".equals(parser.getName())) {
calls.add(getHistoryCall(parser));
}
else if (eventType == XmlPullParser.END_TAG && "calls".equals(parser.getName())) {
done = true;
}
}
}
catch (Exception e) {
Log.error(e);
}
}