Groovy Modules

MarkupBuilder works not the same as NodeBuilder

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Scriptom
  • Labels:
    None
  • Number of attachments :
    0

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>

Activity

Hide
Wang Bin added a comment -

maybe the component of this bug is JDK. But I don't know how to change the component. Even I don't know whether it is possible to modify the component

Show
Wang Bin added a comment - maybe the component of this bug is JDK. But I don't know how to change the component. Even I don't know whether it is possible to modify the component
Hide
Paul King added a comment -

The current implementation of MarkupBuilder cannot support this style of using its API. The supported style of usage just nests the inner elements as needed.

Show
Paul King added a comment - The current implementation of MarkupBuilder cannot support this style of using its API. The supported style of usage just nests the inner elements as needed.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

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