I have a static XML string and I want to populate my FormPanel's text
field with the details from the XML string.
I am able to create a XmlReader or a Store object but am not sure how
to populate a TextField in my FormPanel.

Most of the examples in http://www.gwt-ext.com/demo are to load XML
from a file or retrieve the xml from a url. In my case I already have
the xml string.

The following is my attempt. Can someone please let me where the
mistake is.

Thanks in Advance,
- Pavi

        StringBuffer xml = new StringBuffer();
        xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        xml.append("<catalog> ");

        xml.append("<plant> ");
        xml.append("<common>Bloodroot</common> ");
        xml.append("<botanical>Caltha palustris</botanical> ");
        xml.append("<zone>4</zone> ");
        xml.append("<light>Mostly Shady</light> ");
        xml.append("<price>2.44</price> ");
        xml.append("<availability>03/15/2006</availability> ");
        xml.append("<indoor>true</indoor> ");
        xml.append("</plant> ");

        xml.append("</catalog> ");

        XmlReader reader = new XmlReader("plant", new RecordDef(
                new FieldDef[]{
                        new StringFieldDef("common"),
                        new StringFieldDef("botanical"),
                        new StringFieldDef("light")
                }
        ));

        final Store store = new Store(reader);
        store.loadXmlData(xml.toString(), true);

        FormPanel firstTab = new FormPanel();
        firstTab.setLayout(new FormLayout());
        firstTab.setPaddings(10);
        firstTab.setReader(reader);
        firstTab.add(new TextField("First Name", "common", 190));
        firstTab.getForm().loadRecord(store.getRecordAt(0));


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