[groovy-user] XmlSlurper improvement

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[groovy-user] XmlSlurper improvement

tugwilson
XmlSlurper creates an object which supports GPath expressions. Up to  
now if you want to specify an attribute name you have to put the name  
in quotes:

root.element."@attribute"

The new version in CVS HEAD does away with that restriction. You can  
now write:

root.element.@attribute

You only have to use quotes if the element or attribute name is nor a  
valid Groovy identifier.

I found and fixed a couple of bugs in Invoker on the way and I have  
introduced a new class into groovy.lang - DelegatingMetaClass.

DelegatingMetaClass is a convenience class which helps you wrap an  
object's MetaClass and intercept one or more calls on it.

For an example of its use see  
groovy.itil.streamingmarkupsupport.GPathResult.java


John Wilson
The Wilson Partnership
http://www.wilson.co.uk


Reply | Threaded
Open this post in threaded view
|

Re: [groovy-user] XmlSlurper improvement

Babelex
Very cool, and looks much more integrated, well done John

P.S. can I build Groovy CVS in Eclipse without maven ?
I've been maven free for nearly a year now and don't really want to go back ;)

On 11/4/05, John Wilson <[hidden email]> wrote:

> XmlSlurper creates an object which supports GPath expressions. Up to
> now if you want to specify an attribute name you have to put the name
> in quotes:
>
> root.element."@attribute"
>
> The new version in CVS HEAD does away with that restriction. You can
> now write:
>
> root.element.@attribute
>
> You only have to use quotes if the element or attribute name is nor a
> valid Groovy identifier.
>
> I found and fixed a couple of bugs in Invoker on the way and I have
> introduced a new class into groovy.lang - DelegatingMetaClass.
>
> DelegatingMetaClass is a convenience class which helps you wrap an
> object's MetaClass and intercept one or more calls on it.
>
> For an example of its use see
> groovy.itil.streamingmarkupsupport.GPathResult.java
>
>
> John Wilson
> The Wilson Partnership
> http://www.wilson.co.uk
>
>
>


--
regards
babelex
http://babelex.blogspot.com/
#OpenSource means free to innovate#
Reply | Threaded
Open this post in threaded view
|

Re: [groovy-user] XmlSlurper improvement

Guillaume Laforge
Administrator
On 04/11/05, Babelex <[hidden email]> wrote:
> [...]
> P.S. can I build Groovy CVS in Eclipse without maven ?
> I've been maven free for nearly a year now and don't really want to go back ;)

It's just a matter of typing "maven" on the command-line :-)))

But you can also fetch a snapshot generated by our continuous
integration server:
http://distci.codehaus.org/groovy/jars/

No need to recompile or build anything, just drop the snapshot jar in
your lib directory ;-)

--
Guillaume Laforge
http://glaforge.free.fr/blog/groovy