Hi all,

The GWT XMLParser seems to have a bug wtih respect to escaping of xml
entities like the less-than sign. E.g. writting a less-than sign in a
text node should become '<'. This escaping is performed correctly
when writing the text content in the TEXT node, but when the text node
is added to a parent element it is UNescaped again. Resulting in
invalid XML.

To better illustrate this issue I created a test case:
public class XMLEncodeTest extends GWTTestCase {

    public static final String TEST_TEXT = "Hello < > World";
    public static final String TEST_TAG = "test";
    public static final String EXPECTED_XML = "<test>Hello &lt; &gt;
World</test>";

    @Test
    public void testTestEscape() {
        Document doc = XMLParser.createDocument();
        Text textNode = doc.createTextNode(TEST_TEXT); // everything
is well here, escaping is performed
        Element element = doc.createElement(TEST_TAG);
        element.appendChild(textNode); // BUG: text is unescaped
again!
        doc.appendChild(element);
        Assert.assertTrue(EXPECTED_XML.equals(element.toString()));
    }

    @Override
    public String getModuleName() {
        return "my.tests.gwt.tests";
    }

}

Am I doing something wrong here? Should I report an issue for this on
the gwt issue tracker?

best regards,
Dennis

-- 
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