groovy

DomToGroovy outputs builder code not compatible with MarkupBuilder

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.0-JSR-6
  • Fix Version/s: 1.1-rc-1
  • Component/s: XML Processing
  • Labels:
    None
  • Number of attachments :
    1

Description

If you feed in xml/xhtml into DomToGroovy which looks something like:

<a href="http://groovy.codehaus.org">Groovy</a>

It outputs something like:

a(href:'http://groovy.codehaus.org') ["Groovy"]

but MarkupBuilder seems to currently only like:

a(href:'http://groovy.codehaus.org', "Groovy")

I think we should change DomToGroovy to output the currently supported builder notation.

There is a DomToGroovyTest.groovy file which checks that the currently incompatible behaviour is in place. Perhaps it should be modified to always pass its output back into MarkupBuilder and perhaps (with some XMLUnit magic) check that it produces what was fed in in the first place.

Activity

Hide
Paul King added a comment -

Attached patch and testcase enhancement make DomToGroovy consistent with current MarkupBuilder

Show
Paul King added a comment - Attached patch and testcase enhancement make DomToGroovy consistent with current MarkupBuilder
Hide
Paul King added a comment -

Mostly working now. Reducing prioriity.

Show
Paul King added a comment - Mostly working now. Reducing prioriity.
Hide
Paul King added a comment -

Now has the ability to run like this:

java -cp %GROOVY_CLASSPATH% org.codehaus.groovy.tools.xml.DomToGroovy infile.xml [outfile.groovy]

Also now uses StreamingMarkupBuilder.

Seemed to roundtrip: pom.xml, build.xml, config\checkstyle\checkstyle-frames.xsl

Show
Paul King added a comment - Now has the ability to run like this: java -cp %GROOVY_CLASSPATH% org.codehaus.groovy.tools.xml.DomToGroovy infile.xml [outfile.groovy] Also now uses StreamingMarkupBuilder. Seemed to roundtrip: pom.xml, build.xml, config\checkstyle\checkstyle-frames.xsl

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: