Thursday, June 30, 2011

Re: Tree from xml??

Check out this page, making sure your module's gwt.xml file has the
correct XML inherits:

Also, note that for the parse method, the string you pass in there
needs to be the actual XML document, not a path to its location.

On Jun 30, 4:41 am, swedeveloper <> wrote:
> Hello my name is Jens and I am a beginner in GWT. I was trying to
> teach me this, but right now I'm stuck and need help! I'm trying to
> get a menu to work with XML via xmlparse and a for loop. What I think
> would be given does not seem to be there and it does not work when I
> compiled the file. There is nothing in the html violin is not possible
> to preview using GWT Designer. Be grateful for the help! Jens
> ________________________________________________________________
> //Main menu
> MenuBar menuBar = new MenuBar(true);
>                 vsp.add(menuBar);
>                 //The xml file for menu
>                  Document doc = XMLParser.parse("Xml/SiteMap.xml");
>                  NodeList elements = doc.getElementsByTagName("bookmark");
>                  //Loop for populate the menu with menuitems
>                  //Doesnt work is it here are in the parser?
>                  for (int i = 0; i < elements.getLength(); i++) {
>                 element = elements.item(i);
>          NamedNodeMap attrs = element.getAttributes();
>          //Nodes
>                 String title = attrs.getNamedItem("title").getNodeValue();
>                  String url = attrs.getNamedItem("url").getNodeValue();
>                 System.out.println(title + url + "/n" );
>                 //Menu Populates from xml
>                 MenuItem bookmark =
>                 new MenuItem(title, URL(url));
>                  menuBar.addItem(bookmark);
> ____________________________________________________________________

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment