@Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) { buf.append(" jid=\"").append(userJID).append("\">"); buf.append("<timeout>").append(Integer.toString(timeout)).append("</timeout>"); if (sessionID != null) { buf.append('<').append(SessionID.ELEMENT_NAME); buf.append(" session=\""); buf.append(getSessionID()).append("\" xmlns=\""); buf.append(SessionID.NAMESPACE).append("\"/>"); } if (metaData != null) { buf.append(MetaDataUtils.serializeMetaData(metaData)); } if (userID != null) { buf.append('<').append(UserID.ELEMENT_NAME); buf.append(" id=\""); buf.append(userID).append("\" xmlns=\""); buf.append(UserID.NAMESPACE).append("\"/>"); } return buf; }
@Override public ChatMetadata parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { final ChatMetadata chatM = new ChatMetadata(); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("sessionID")) { chatM.setSessionID(parser.nextText()); } else if (parser.getName().equals("metadata")) { Map<String, List<String>> map = MetaDataUtils.parseMetaData(parser); chatM.setMetadata(map); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals(ELEMENT_NAME)) { done = true; } } } return chatM; }
public IQ parseIQ(XmlPullParser parser) throws Exception { final ChatMetadata chatM = new ChatMetadata(); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("sessionID")) { chatM.setSessionID(parser.nextText()); } else if (parser.getName().equals("metadata")) { Map map = MetaDataUtils.parseMetaData(parser); chatM.setMetadata(map); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals(ELEMENT_NAME)) { done = true; } } } return chatM; }
public IQ parseIQ(XmlPullParser parser) throws Exception { final ChatMetadata chatM = new ChatMetadata(); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("sessionID")) { chatM.setSessionID(parser.nextText()); } else if (parser.getName().equals("metadata")) { Map<String, List<String>> map = MetaDataUtils.parseMetaData(parser); chatM.setMetadata(map); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals(ELEMENT_NAME)) { done = true; } } } return chatM; }
/** * PacketExtensionProvider implementation */ public PacketExtension parseExtension (XmlPullParser parser) throws Exception { Map metaData = MetaDataUtils.parseMetaData(parser); return new MetaData(metaData); }
public String getChildElementXML () { StringBuilder buf = new StringBuilder(); buf.append("<offer xmlns=\"http://jabber.org/protocol/workgroup\" jid=\"").append(userJID).append("\">"); buf.append("<timeout>").append(timeout).append("</timeout>"); if (sessionID != null) { buf.append('<').append(SessionID.ELEMENT_NAME); buf.append(" session=\""); buf.append(getSessionID()).append("\" xmlns=\""); buf.append(SessionID.NAMESPACE).append("\"/>"); } if (metaData != null) { buf.append(MetaDataUtils.serializeMetaData(metaData)); } if (userID != null) { buf.append('<').append(UserID.ELEMENT_NAME); buf.append(" id=\""); buf.append(userID).append("\" xmlns=\""); buf.append(UserID.NAMESPACE).append("\"/>"); } buf.append("</offer>"); return buf.toString(); }
/** * PacketExtensionProvider implementation */ public PacketExtension parseExtension (XmlPullParser parser) throws Exception { Map<String, List<String>> metaData = MetaDataUtils.parseMetaData(parser); return new MetaData(metaData); }
/** * PacketExtensionProvider implementation */ public PacketExtension parseExtension(XmlPullParser parser) throws Exception { Map metaData = MetaDataUtils.parseMetaData(parser); return new MetaData(metaData); }
public String getChildElementXML() { StringBuilder buf = new StringBuilder(); buf.append( "<offer xmlns=\"http://jabber.org/protocol/workgroup\" jid=\"") .append(userJID).append("\">"); buf.append("<timeout>").append(timeout).append("</timeout>"); if (sessionID != null) { buf.append('<').append(SessionID.ELEMENT_NAME); buf.append(" session=\""); buf.append(getSessionID()).append("\" xmlns=\""); buf.append(SessionID.NAMESPACE).append("\"/>"); } if (metaData != null) { buf.append(MetaDataUtils.serializeMetaData(metaData)); } if (userID != null) { buf.append('<').append(UserID.ELEMENT_NAME); buf.append(" id=\""); buf.append(userID).append("\" xmlns=\""); buf.append(UserID.NAMESPACE).append("\"/>"); } buf.append("</offer>"); return buf.toString(); }
public String toXML() { return MetaDataUtils.serializeMetaData(this.getMetaData()); }
/** * PacketExtensionProvider implementation * @throws IOException * @throws XmlPullParserException */ public MetaData parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { Map<String, List<String>> metaData = MetaDataUtils.parseMetaData(parser); return new MetaData(metaData); }