All pastes #366435 Raw Edit

Someone

public text v1 · immutable
#366435 ·published 2007-02-21 17:56 UTC
rendered paste body
public class Test {
  public static void main(String[] args) {
    XmlBuffer buf = new XmlBuffer();

    try {
      buf
        .openTag("ItemDiscountAddRq")
          .openTag("ItemDiscountAdd").addAttribute("foo", "b&ar").addAttribute("biz", "bam")
            .textTag("Name", "Foobar")
          .closeTag()
          .openTag("ItemDiscountDel")
            .textTag("Foo", "barfoo")
          .closeTag()
        .closeTag();


Output:
<?xml version="1.0"?>
<ItemDiscountAddRq>
  <ItemDiscountAdd foo="b&amp;ar" biz="bam">
    <Name>Foobar</Name>
  </ItemDiscountAdd>
  <ItemDiscountDel>
    <Foo>barfoo</Foo>
  </ItemDiscountDel>
</ItemDiscountAddRq>