Esempio n. 1
0
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder();
   xml.halfOpenElement("feature");
   xml.attribute("var", variable);
   xml.closeEmptyElement();
   return xml;
 }
Esempio n. 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;
 }
Esempio n. 3
0
 @Override
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder(this);
   xml.rightAngleBracket();
   xml.append(fwd.toXML());
   xml.closeElement(this);
   return xml;
 }
Esempio n. 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);
 }
Esempio n. 5
0
 /**
  * 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;
 }
Esempio n. 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;
 }
Esempio n. 7
0
 @Override
 public XmlStringBuilder toXML() {
   XmlStringBuilder xml = new XmlStringBuilder(this);
   xml.rightAngleBracket();
   xml.optElement("password", getPassword());
   xml.optElement(getHistory());
   xml.closeElement(this);
   return xml;
 }
Esempio n. 8
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;
   }
 }
Esempio n. 9
0
 /**
  * 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());
     }
   }
 }
Esempio n. 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;
 }
Esempio n. 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;
 }
Esempio n. 12
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;
 }
Esempio n. 13
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;
 }
Esempio n. 14
0
 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;
 }
Esempio n. 15
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;
 }
Esempio n. 16
0
 /**
  * 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());
   }
 }
Esempio n. 17
0
 /**
  * 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());
 }