コード例 #1
0
ファイル: DiscoverInfo.java プロジェクト: CUjamin/Smack
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder();
   xml.halfOpenElement("feature");
   xml.attribute("var", variable);
   xml.closeEmptyElement();
   return xml;
 }
コード例 #2
0
 public XmlStringBuilder toXML()
 {
     XmlStringBuilder xmlstringbuilder = new XmlStringBuilder(this);
     xmlstringbuilder.rightAngleBracket();
     for (Iterator iterator = getBodies().iterator(); iterator.hasNext(); xmlstringbuilder.append((CharSequence)iterator.next())) { }
     xmlstringbuilder.closeElement(this);
     return xmlstringbuilder;
 }
コード例 #3
0
ファイル: CarbonExtension.java プロジェクト: abmargb/Smack
 @Override
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder(this);
   xml.rightAngleBracket();
   xml.append(fwd.toXML());
   xml.closeElement(this);
   return xml;
 }
コード例 #4
0
 @Override
 protected void childrenElements(XmlStringBuilder builder) {
   if (nickName != null) {
     builder.halfOpenElement("member").attribute("nickname", nickName).closeEmptyElement();
   }
   builder.optElement("reason", reason);
   super.childrenElements(builder);
 }
コード例 #5
0
ファイル: Stanza.java プロジェクト: sharnell/Smack
 /**
  * Returns the extension sub-packets (including properties data) as an XML String, or the Empty
  * String if there are no stanza(/packet) extensions.
  *
  * @return the extension sub-packets as XML or the Empty String if there are no stanza(/packet)
  *     extensions.
  */
 protected final XmlStringBuilder getExtensionsXML() {
   XmlStringBuilder xml = new XmlStringBuilder();
   // Add in all standard extension sub-packets.
   for (ExtensionElement extension : getExtensions()) {
     xml.append(extension.toXML());
   }
   return xml;
 }
コード例 #6
0
 public final CharSequence toXML() {
   XmlStringBuilder buf = new XmlStringBuilder();
   buf.halfOpenElement(this.elementName).xmlnsAttribute(this.namespace).rightAngleBracket();
   for (String name : getNames()) {
     buf.element(name, getValue(name));
   }
   buf.closeElement(this.elementName);
   return buf;
 }
コード例 #7
0
ファイル: MUCInitialPresence.java プロジェクト: abmargb/Smack
 @Override
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder(this);
   xml.rightAngleBracket();
   xml.optElement("password", getPassword());
   xml.optElement(getHistory());
   xml.closeElement(this);
   return xml;
 }
コード例 #8
0
ファイル: PacketParserUtils.java プロジェクト: sheytoon/Syna
 private static CharSequence parseContentDepthWithoutRoundtrip(
     XmlPullParser xmlPullParser, int i, boolean z) throws XmlPullParserException, IOException {
   XmlStringBuilder xmlStringBuilder = new XmlStringBuilder();
   Object obj = null;
   int eventType = xmlPullParser.getEventType();
   String str = null;
   while (true) {
     Object obj2;
     switch (eventType) {
       case VideoSize.HVGA /*2*/:
         xmlStringBuilder.halfOpenElement(xmlPullParser.getName());
         if (str == null || z) {
           String namespace = xmlPullParser.getNamespace();
           if (StringUtils.isNotEmpty(namespace)) {
             xmlStringBuilder.attribute("xmlns", namespace);
             str = xmlPullParser.getName();
           }
         }
         for (eventType = 0; eventType < xmlPullParser.getAttributeCount(); eventType++) {
           xmlStringBuilder.attribute(
               xmlPullParser.getAttributeName(eventType),
               xmlPullParser.getAttributeValue(eventType));
         }
         if (!xmlPullParser.isEmptyElementTag()) {
           xmlStringBuilder.rightAngleBracket();
           obj2 = obj;
           break;
         }
         xmlStringBuilder.closeEmptyElement();
         obj2 = 1;
         continue;
       case Version.API03_CUPCAKE_15 /*3*/:
         if (obj != null) {
           obj2 = null;
         } else {
           xmlStringBuilder.closeElement(xmlPullParser.getName());
           obj2 = obj;
         }
         if (str != null && str.equals(xmlPullParser.getName())) {
           str = null;
         }
         if (xmlPullParser.getDepth() <= i) {
           return xmlStringBuilder;
         }
         continue;
       case Version.API04_DONUT_16 /*4*/:
         xmlStringBuilder.append(xmlPullParser.getText());
         break;
     }
     obj2 = obj;
     Object obj3 = obj2;
     eventType = xmlPullParser.next();
     obj = obj3;
   }
 }
コード例 #9
0
ファイル: XmlStringBuilder.java プロジェクト: jiseruk/Smack
 /**
  * Write the contents of this <code>XmlStringBuilder</code> to a {@link Writer}. This will write
  * the single parts one-by-one, avoiding allocation of a big continuous memory block holding the
  * XmlStringBuilder contents.
  *
  * @param writer
  * @throws IOException
  */
 public void write(Writer writer) throws IOException {
   for (CharSequence csq : sb.getAsList()) {
     if (csq instanceof XmlStringBuilder) {
       ((XmlStringBuilder) csq).write(writer);
     } else {
       writer.write(csq.toString());
     }
   }
 }
コード例 #10
0
 public XmlStringBuilder toXML() {
   XmlStringBuilder xmlstringbuilder = new XmlStringBuilder();
   xmlstringbuilder.halfOpenElement(getElementName());
   xmlstringbuilder.attribute("node", getNode());
   xmlstringbuilder.optAttribute("subid", getSubscriptionId());
   xmlstringbuilder.optIntAttribute("max_items", getMaxItems());
   xmlstringbuilder.closeEmptyElement();
   return xmlstringbuilder;
 }
コード例 #11
0
 public final XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder((PacketExtension) this);
   xml.attribute("seq", Long.toString(this.seq));
   xml.attribute("sid", this.sessionID);
   xml.rightAngleBracket();
   xml.append(this.data);
   xml.closeElement((NamedElement) this);
   return xml;
 }
コード例 #12
0
ファイル: DiscoverInfo.java プロジェクト: CUjamin/Smack
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder();
   xml.halfOpenElement("identity");
   xml.xmllangAttribute(lang);
   xml.attribute("category", category);
   xml.optAttribute("name", name);
   xml.optAttribute("type", type);
   xml.closeEmptyElement();
   return xml;
 }
コード例 #13
0
ファイル: DelayInformation.java プロジェクト: abmargb/Smack
 @Override
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder(this);
   xml.attribute("stamp", XmppDateTime.formatXEP0082Date(stamp));
   xml.optAttribute("from", from);
   xml.rightAngleBracket();
   xml.optAppend(reason);
   xml.closeElement(this);
   return xml;
 }
コード例 #14
0
ファイル: MUCInitialPresence.java プロジェクト: abmargb/Smack
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder(this);
   xml.optIntAttribute("maxchars", getMaxChars());
   xml.optIntAttribute("maxstanzas", getMaxStanzas());
   xml.optIntAttribute("seconds", getSeconds());
   if (getSince() != null) {
     xml.attribute("since", XmppDateTime.formatXEP0082Date(getSince()));
   }
   xml.closeEmptyElement();
   return xml;
 }
コード例 #15
0
ファイル: XMPPError.java プロジェクト: sheytoon/Soroush
 public XmlStringBuilder toXML() {
   XmlStringBuilder xmlStringBuilder = new XmlStringBuilder();
   xmlStringBuilder.halfOpenElement(ERROR);
   xmlStringBuilder.attribute("type", this.type.toString());
   xmlStringBuilder.optAttribute("by", this.errorGenerator);
   xmlStringBuilder.rightAngleBracket();
   xmlStringBuilder.halfOpenElement(this.condition.toString());
   xmlStringBuilder.xmlnsAttribute(NAMESPACE);
   if (this.conditionText != null) {
     xmlStringBuilder.rightAngleBracket();
     xmlStringBuilder.escape(this.conditionText);
     xmlStringBuilder.closeElement(this.condition.toString());
   } else {
     xmlStringBuilder.closeEmptyElement();
   }
   addDescriptiveTextsAndExtensions(xmlStringBuilder);
   xmlStringBuilder.closeElement(ERROR);
   return xmlStringBuilder;
 }
コード例 #16
0
ファイル: Stanza.java プロジェクト: sharnell/Smack
 /**
  * Append an XMPPError is this stanza(/packet) has one set.
  *
  * @param xml the XmlStringBuilder to append the error to.
  */
 protected void appendErrorIfExists(XmlStringBuilder xml) {
   XMPPError error = getError();
   if (error != null) {
     xml.append(error.toXML());
   }
 }
コード例 #17
0
ファイル: Stanza.java プロジェクト: sharnell/Smack
 /**
  * Add to, from, id and 'xml:lang' attributes
  *
  * @param xml
  */
 protected void addCommonAttributes(XmlStringBuilder xml) {
   xml.optAttribute("to", getTo());
   xml.optAttribute("from", getFrom());
   xml.optAttribute("id", getStanzaId());
   xml.xmllangAttribute(getLanguage());
 }