XML処理に静的に型付けされたGroovy ++を使用できますか?
例 (テストにはGroovy++ Web コンソールを使用できます):
@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
結果:
startup failed:
Script1.groovy: 14: Cannot find property car of class GPathResult
@ line 14, column 9.
records.car
^
1 error