Tuesday, October 22, 2013

Why is XMLParser not parsing camel case attributes?

Hi everyone,

I'm trying to parse my xml string that contains some camel case attributes and for some reason it just doesn't work.

Below is a simple test to help:

@Test
public void xmlAttributeParsingProblem() {
    Document oDoc = XMLParser.parse("<toto><tata myAttribute=\"titi\" myAttribute2=\"tete\" test=\"test1\" testMe=\"hello\" test_me=\"world\"><tutu/></tata></toto>");
    Node oToto = oDoc.getChildNodes().item(0);
    Node oTata = oToto.getFirstChild();

    assertEquals("test1", oTata.getAttributes().getNamedItem("test").getNodeValue()); //WORKS
    assertEquals("world", oTata.getAttributes().getNamedItem("test_me").getNodeValue()); //WORKS!
    assertEquals("hello", oTata.getAttributes().getNamedItem("testMe").getNodeValue()); // DOES NOT WORK
    assertEquals("tete", oTata.getAttributes().getNamedItem("myAttribute2").getNodeValue()); // DOES NOT WORK
    assertEquals("titi", oTata.getAttributes().getNamedItem("myAttribute").getNodeValue()); // DOES NOT WORK
}

Any ideas why is that happening? I'm using gwt-test-utils by the way, but would that be the issue? like something on their end?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment