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;
 }
Exemple #2
0
 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;
   }
 }
Exemple #3
0
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder();
   xml.halfOpenElement("feature");
   xml.attribute("var", variable);
   xml.closeEmptyElement();
   return xml;
 }
 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;
 }
Exemple #5
0
 @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;
 }
Exemple #6
0
 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;
 }
 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;
 }
Exemple #8
0
 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;
 }
Exemple #9
0
 public XmlStringBuilder condAttribute(boolean condition, String name, String value) {
   if (condition) {
     attribute(name, value);
   }
   return this;
 }
Exemple #10
0
 /**
  * Add the given attribute if value not null and {@code value => 0}.
  *
  * @param name
  * @param value
  * @return a reference to this object
  */
 public XmlStringBuilder optLongAttribute(String name, Long value) {
   if (value != null && value >= 0) {
     attribute(name, Long.toString(value));
   }
   return this;
 }
Exemple #11
0
 /**
  * Add the given attribute if {@code value => 0}.
  *
  * @param name
  * @param value
  * @return a reference to this object
  */
 public XmlStringBuilder optIntAttribute(String name, int value) {
   if (value >= 0) {
     attribute(name, Integer.toString(value));
   }
   return this;
 }
Exemple #12
0
 public XmlStringBuilder optAttribute(String name, Enum<?> value) {
   if (value != null) {
     attribute(name, value.toString());
   }
   return this;
 }
Exemple #13
0
 public XmlStringBuilder optAttribute(String name, CharSequence value) {
   if (value != null) {
     attribute(name, value.toString());
   }
   return this;
 }
Exemple #14
0
 /**
  * Add a new attribute to this builder, with the {@link java.util.Date} instance as its value,
  * which will get formated with {@link XmppDateTime#formatXEP0082Date(Date)} if {@link
  * java.util.Date} instance is not <code>null</code>.
  *
  * @param name attribute name
  * @param value value of this attribute
  * @return this XmlStringBuilder
  */
 public XmlStringBuilder optAttribute(String name, Date value) {
   if (value != null) {
     attribute(name, value);
   }
   return this;
 }
Exemple #15
0
 public XmlStringBuilder attribute(String name, Enum<?> value) {
   assert value != null;
   attribute(name, value.name());
   return this;
 }