org.xmlpull.mxp1.MXParser Java Examples
The following examples show how to use
org.xmlpull.mxp1.MXParser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserDAOImple.java From tddl5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("static-access") public UserDAOImple(){ this.map = new HashMap<Long, UserDO>(); this.xpp = new MXParser(); this.xsl = new MXSerializer(); this.maxId = Long.MIN_VALUE; }
Example #2
Source File: XMPPReceiver.java From saros with GNU General Public License v2.0 | 6 votes |
public XMPPReceiver( DispatchThreadContext dispatchThreadContext, XMPPConnectionService connectionService, DataTransferManager dataTransferManager) { this.dispatchThreadContext = dispatchThreadContext; this.parser = new MXParser(); connectionService.addListener(connectionListener); dataTransferManager.addConnectionListener( new IByteStreamConnectionListener() { @Override public void connectionChanged( final String connectionId, final IByteStreamConnection connection, final boolean incomingRequest) { connection.setBinaryXMPPExtensionReceiver(XMPPReceiver.this); } }); }
Example #3
Source File: Xpp3DomBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
/** * @deprecated As of 1.4, use {@link XppDom#build(XmlPullParser)} instead */ public static Xpp3Dom build(Reader reader) throws Exception { XmlPullParser parser = new MXParser(); parser.setInput(reader); try { return (Xpp3Dom)XppDom.build(parser); } finally { reader.close(); } }
Example #4
Source File: ChatTranscripts.java From Spark with Apache License 2.0 | 5 votes |
/** * 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; } } in.close(); } catch (Exception e) { e.printStackTrace(); } return transcript; }
Example #5
Source File: ConversationHistoryPlugin.java From Spark with Apache License 2.0 | 5 votes |
/** * 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())) { EntityBareJid jid = JidCreate.entityBareFromUnescapedOrThrowUnchecked(parser.nextText()); historyList.add(jid); } else if (eventType == XmlPullParser.END_TAG && "conversations".equals(parser.getName())) { done = true; } } in.close(); } catch (Exception e) { Log.error(e); } }
Example #6
Source File: PhonebookManager.java From Spark with Apache License 2.0 | 5 votes |
/** * 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; } } in.close(); } catch (Exception e) { Log.error(e); } }
Example #7
Source File: LogManagerImpl.java From Spark with Apache License 2.0 | 5 votes |
/** * 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; } } in.close(); } catch (Exception e) { Log.error(e); } }
Example #8
Source File: Xpp3Driver.java From lams with GNU General Public License v2.0 | 4 votes |
/** * {@inheritDoc} */ protected XmlPullParser createParser() { return new MXParser(); }
Example #9
Source File: Xpp3DomDriver.java From lams with GNU General Public License v2.0 | 4 votes |
/** * {@inheritDoc} */ protected XmlPullParser createParser() { return new MXParser(); }
Example #10
Source File: VipDAOImple.java From tddl5 with Apache License 2.0 | 4 votes |
public VipDAOImple(){ map = new HashMap<Long, VipDO>(); xpp = new MXParser(); xsl = new MXSerializer(); maxId = Long.MIN_VALUE; }
Example #11
Source File: PropertyDAOImple.java From tddl5 with Apache License 2.0 | 4 votes |
public PropertyDAOImple(){ this.xpp = new MXParser(); this.xsl = new MXSerializer(); this.property = new PropertyDO(); }
Example #12
Source File: CobarDAOImple.java From tddl5 with Apache License 2.0 | 4 votes |
public CobarDAOImple(){ map = new HashMap<Long, CobarDO>(); xpp = new MXParser(); xsl = new MXSerializer(); maxId = Long.MIN_VALUE; }
Example #13
Source File: ClusterDAOImple.java From tddl5 with Apache License 2.0 | 4 votes |
public ClusterDAOImple(){ map = new HashMap<Long, ClusterDO>(); xpp = new MXParser(); xsl = new MXSerializer(); maxId = Long.MIN_VALUE; }
Example #14
Source File: PitXmlDriver.java From pitest with Apache License 2.0 | 4 votes |
@Override protected synchronized XmlPullParser createParser() throws XmlPullParserException { return new MXParser(); }
Example #15
Source File: OperatorMenu.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
static XppDom createDom(String xml) { XppDomWriter domWriter = new XppDomWriter(); new HierarchicalStreamCopier().copy(new XppReader(new StringReader(xml), new MXParser()), domWriter); return domWriter.getConfiguration(); }
Example #16
Source File: VCardManager.java From Spark with Apache License 2.0 | 4 votes |
/** * Initialize VCardManager. */ public VCardManager() { // Register providers ProviderManager.addExtensionProvider( JabberAvatarExtension.ELEMENT_NAME, JabberAvatarExtension.NAMESPACE, new JabberAvatarExtension.Provider() ); ProviderManager.addExtensionProvider( VCardUpdateExtension.ELEMENT_NAME, VCardUpdateExtension.NAMESPACE, new VCardUpdateExtension.Provider() ); // 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(); personalVCardAvatar = null; personalVCardHash = null; // 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. StanzaFilter presenceFilter = new StanzaTypeFilter(Presence.class); SparkManager.getConnection().addPacketInterceptor( stanza -> { Presence newPresence = (Presence)stanza; VCardUpdateExtension update = new VCardUpdateExtension(); JabberAvatarExtension jax = new JabberAvatarExtension(); ExtensionElement updateExt = newPresence.getExtension(update.getElementName(), update.getNamespace()); ExtensionElement jabberExt = newPresence.getExtension(jax.getElementName(), jax.getNamespace()); if (updateExt != null) { newPresence.removeExtension(updateExt); } if (jabberExt != null) { newPresence.removeExtension(jabberExt); } if (personalVCard != null) { if ( personalVCardAvatar == null ) { personalVCardAvatar = personalVCard.getAvatar(); } if (personalVCardAvatar != null && personalVCardAvatar.length > 0) { if ( personalVCardHash == null ) { personalVCardHash = personalVCard.getAvatarHash(); } update.setPhotoHash(personalVCardHash); jax.setPhotoHash(personalVCardHash); newPresence.addExtension(update); newPresence.addExtension(jax); } } }, presenceFilter); editor = new VCardEditor(); // Start Listener startQueueListener(); }