Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Re: Strange behavior of Groovy regarding XML whitespace

Jean-Noël Rivasseau

2008-08-28

Replies: Find Java Web Hosting

Author LoginPost Reply
*bump*

> Can anyone explain me why the following code
>
> import groovy.xml.DOMBuilder
> import groovy.xml.dom.DOMCategory
>
> def doc = groovy.xml.DOMBuilder.parse(new StringReader("<body><x>  x
> </x></body>"));
> use(groovy.xml.dom.DOMCategory)
> {
> println ">" + doc.x.text() + "<"
> println ">" + doc.x[0].children()[0].text() + "<"
> }
>
> produces
>
>>  x  <
>>x<
>
> Eg, in the first case the whitespace is kept, in the second it is
> trimmed. Is this a bug, expected behavior (in this case where is it
> documented)? What does the XML specification says in this matter?
>
> My personal guess is that the objects used are not the same. But what
> are exactly those objects then?
>
> Jean-Noel
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.