Hi all, I'm trying to parse (client-side) an XML file, here is the structure:
<?xml version="1.0" encoding="utf-8" ?> <model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ModelSchema.xsd" id="modelId" extends="models/otherModel.xml"> <name>Model Name</name> <description>Brief Model description</description> <characteristic enum="1"> <!-- non relevant child nodes --> </characteristic> <characteristic enum="2"> <!-- non relevant child nodes --> </characteristic> </model> I successully parsed the xml file (RequestBuilder, etc...). This is the java code section (relevant part only): Document modelDocument = XMLParser.parse(.....); Node root = modelDocument.getElementsByTagName("model").item(0); NodeList childNodes = root.getChildNodes(); My goal is to get the value of the nodes <name> and <description>, first and second child of the <model> node (known as *root*, in the java code), but I didn't get what I expected. So I put a set of *GWT.log* calls, and this is the result: GWT.log(childNodes.item(0).toString()); // output = '' GWT.log(childNodes.item(1).toString()); // output = '<name>Model Name</name>' GWT.log(childNodes.item(2).toString()); // output = '' GWT.log(childNodes.item(3).toString()); // output = '<description>Brief Model description</description>' GWT.log(childNodes.item(4).toString()); // output = '' GWT.log(childNodes.item(5).toString()); // output = '<characteristic enum="1">...</characteristic>' GWT.log(childNodes.item(6).toString()); // output = '' GWT.log(childNodes.item(7).toString()); // output = '<characteristic enum="2">...</characteristic>' I'm happy I finally got the right values, but I still don't understand why the children nodes correspond only to odd indexes, is such a weird thing. Am I doing something wrong? Thank you. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
