当前位置: 首页>>代码示例>>Java>>正文


Java MXParser.next方法代码示例

本文整理汇总了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;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:36,代码来源:ChatTranscripts.java

示例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);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:31,代码来源:ConversationHistoryPlugin.java

示例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);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:31,代码来源:PhonebookManager.java

示例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);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:31,代码来源:LogManagerImpl.java


注:本文中的org.xmlpull.mxp1.MXParser.next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。