Exemplo n.º 1
0
 /**
  * Does nothing if value is null.
  *
  * @param name
  * @param value
  * @return the XmlStringBuilder
  */
 public XmlStringBuilder attribute(String name, String value) {
   assert value != null;
   sb.append(' ').append(name).append("='");
   escape(value);
   sb.append('\'');
   return this;
 }
Exemplo n.º 2
0
 /**
  * Add a new element to this builder.
  *
  * @param name
  * @param content
  * @return the XmlStringBuilder
  */
 public XmlStringBuilder element(String name, String content) {
   assert content != null;
   openElement(name);
   escape(content);
   closeElement(name);
   return this;
 }
Exemplo n.º 3
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;
 }