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


Java MXParser.setFeature方法代码示例

本文整理汇总了Java中org.xmlpull.mxp1.MXParser.setFeature方法的典型用法代码示例。如果您正苦于以下问题:Java MXParser.setFeature方法的具体用法?Java MXParser.setFeature怎么用?Java MXParser.setFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xmlpull.mxp1.MXParser的用法示例。


在下文中一共展示了MXParser.setFeature方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Combiner

import org.xmlpull.mxp1.MXParser; //导入方法依赖的package包/类
public Combiner(ManifestResolver resolver, Writer output) throws IOException, XmlPullParserException
{
	this.output = output;
	this.resolver = resolver;

	Reader reader = null;
	try
	{
		reader = resolver.getStream();

		parser = new MXParser();
		parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
		parser.setInput(reader);

		parseXml();
	}
	finally
	{
		Closeables.close(reader, true); // Quietly
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:22,代码来源:IMSUtilities.java

示例2: setUp

import org.xmlpull.mxp1.MXParser; //导入方法依赖的package包/类
public void setUp()
            throws Exception
    {
//        xmlPullParserFactory = XmlPullParserFactory.newInstance();
//        xmlPullParserFactory.setNamespaceAware(true);
//
//        xmlPullParser = xmlPullParserFactory.newPullParser();
        xmlPullParser = new MXParser();
        xmlPullParser.setFeature(
            "http://xmlpull.org/v1/doc/features.html#process-namespaces",
            true);

        AbstractSmackInteroperabilityLayer.setImplementationClass(
                SmackV3InteroperabilityLayer.class);
        colibriIQProvider = new ColibriIQProvider();
    }
 
开发者ID:jitsi,项目名称:jitsi,代码行数:17,代码来源:ColibriIQProviderTest.java

示例3: resetParser

import org.xmlpull.mxp1.MXParser; //导入方法依赖的package包/类
/**
 * Resets the parser using the latest connection's reader. Reseting the parser is necessary
 * when the plain connection has been secured or when a new opening stream element is going
 * to be sent by the server.
 */
private void resetParser() {
    try {
        parser = new MXParser();
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
        parser.setInput(connection.reader);
    }
    catch (XmlPullParserException xppe) {
        xppe.printStackTrace();
    }
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:16,代码来源:PacketReader.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: getParserFromXML

import org.xmlpull.mxp1.MXParser; //导入方法依赖的package包/类
private XmlPullParser getParserFromXML(String xml) throws XmlPullParserException {
	MXParser parser = new MXParser();
	parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
	parser.setInput(new StringReader(xml));
	return parser;
}
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:7,代码来源:XMPPErrorTest.java

示例9: VCardManager

import org.xmlpull.mxp1.MXParser; //导入方法依赖的package包/类
/**
 * Initialize VCardManager.
 */
public VCardManager() {
    // Initialize parser
    parser = new MXParser();

    try {
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
    }
    catch (XmlPullParserException e) {
        Log.error(e);
    }

    imageFile = new File(SparkManager.getUserDirectory(), "personal.png");

    // Initialize vCard.
    personalVCard = new VCard();

    // Set VCard Storage
    vcardStorageDirectory = new File(SparkManager.getUserDirectory(), "vcards");
    vcardStorageDirectory.mkdirs();

    // Set the current user directory.
    contactsDir = new File(SparkManager.getUserDirectory(), "contacts");
    contactsDir.mkdirs();

    initializeUI();

    // Intercept all presence packets being sent and append vcard information.
    PacketFilter presenceFilter = new PacketTypeFilter(Presence.class);
    SparkManager.getConnection().addPacketInterceptor(new PacketInterceptor() {
        public void interceptPacket(Packet packet) {
            Presence newPresence = (Presence)packet;
            VCardUpdateExtension update = new VCardUpdateExtension();
            JabberAvatarExtension jax = new JabberAvatarExtension();

            PacketExtension updateExt = newPresence.getExtension(update.getElementName(), update.getNamespace());
            PacketExtension jabberExt = newPresence.getExtension(jax.getElementName(), jax.getNamespace());

            if (updateExt != null) {
                newPresence.removeExtension(updateExt);
            }

            if (jabberExt != null) {
                newPresence.removeExtension(jabberExt);
            }

            if (personalVCard != null) {
                byte[] bytes = personalVCard.getAvatar();
                if (bytes != null && bytes.length > 0) {
                    update.setPhotoHash(personalVCard.getAvatarHash());
                    jax.setPhotoHash(personalVCard.getAvatarHash());

                    newPresence.addExtension(update);
                    newPresence.addExtension(jax);
                }
            }
        }
    }, presenceFilter);

    editor = new VCardEditor();

    // Start Listener
    startQueueListener();
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:67,代码来源:VCardManager.java


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