Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-780

MarkupBuilder works not the same as NodeBuilder

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.0-beta-10
    • 1.0-JSR-2
    • groovy-jdk
    • None

    Description

      writer = new java.io.StringWriter()
      builder = new groovy.xml.MarkupBuilder(writer)
      customers = builder.customers() {
      acustomer = builder.cusomer(name:"John")
      builder.setCurrent(acustomer)
      builder.order()
      }
      println writer.toString()

      /* the output is
      <customers>
      <customer name='John' />
      <order />
      </customers>
      */

      But if I let builder be NodeBuilder. e.g.
      builder = new groovy.util.NodeBuilder()

      the LOGIC of customers is like
      <customers>
      <customer name='John' >
      <order/>
      </customer>
      </customers>

      Attachments

        Activity

          People

            Unassigned Unassigned
            wangbin wangbin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified