Can be used statically typed Groovy++ for XML processing?
Example (for testing you can use Groovy++ web console):
@Typed package test
def CAR_RECORDS = '''
<records>
<car name='HSV Maloo' make='Holden' year='2006'>
<country>Australia</country>
<record type='speed'>Production Pickup Truck with speed of 271kph</record>
</car>
</records>
'''
def records = new XmlSlurper().parseText(CAR_RECORDS)
println records.car
The result:
startup failed:
Script1.groovy: 14: Cannot find property car of class GPathResult
@ line 14, column 9.
records.car
^
1 error
Doesn't look like it... You can use:
and then
works, but you cannot get to attribute values via:
As you then get the error:
I guess XmlSlurping is currently a bit too dynamic for groovy++