On 5 sep, 04:49, perry <[EMAIL PROTECTED]> wrote:
> thinking about following xml fragment:
>
> <gradingcriterion>
>       <label>Subject/discipline content &amp; knowledge</label>
>       <value>knowledge</value>
>  </gradingcriterion>
>
> when I use getChildNodes().getLength(), the result I get is 5 instead
> of 2.

5 is correct: text nodes are nodes, even if they're all whitespace.

> I re-edit the above xml fragment as a single line:
>
> <gradingcriterion><label>Subject/discipline content &amp;knowledge</
> label><value>knowledge</value></gradingcriterion>
>
> The result I get is 2.

Yep, you removed the text nodes.

> So it is obvious that "/n" is considered as a child node by GWT.

Correction: by XML, InfoSet and the DOM.
BWT, GWT doesn't to the XML parsing by itself, it delegates to the
browser (an ActiveX on IE, some special object on others)

> So is there way to walk around this problem?

Window.alert("Before: " + gradingcriterion.getChildNodes.getLength());
XMLParser.removeWhitespace(gradingcriterion);
Window.alert("After: " + gradingcriterion.getChildNodes.getLength());


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to