1 Reply Latest reply: Sep 17, 2008 4:07 AM by tbuteler RSS

    xml into list data

    Kristtee Community Member
      Hi
      can someone tell me how to get xml data into list. For instance..here is my xml.
      <leads>
      <lead>
      <title>Adobe</title>
      <url> http://www.adobe.com</url>
      </lead>
      </leads>

      then i want get the url for option value and title for data. like...

      <select name="list" size="10" id="locallist">
      <option value="{url}">{tit}</option>
      </select>
      i could not get it. need some help. please.
      Thank you
        • 1. xml into list data
          tbuteler
          For starters, there seems to be an error on the code you listed:

          <option value="{url}">{tit}</option>

          According to your XML it should be {title}. Maybe you changed something and forgot to update your XML or your HTML?

          Second, to make sure we're covering everything, we need to see how you've created the dataset with Spry, with a line like this (example):

          var ds1 = new Spry.Data.XMLDataSet("list.xml", "leads/lead");

          Notice how the second part (XPath declaration) tell Spry where in your XML you want it to check for data. It's likely that it's looking in the wrong place if your list is not showing, but no errors are informed.

          Lastly, make sure you have the external links to the Spry JS files (considering they're on the same root as your HTML and XML, otherwise correct the URLs):

          <script language="JavaScript" type="text/javascript" src="xpath.js"></script>
          <script language="JavaScript" type="text/javascript" src="SpryData.js"></script>

          That should do it, right? It is quite simple, so you should nail it in no time.

          Best regards,

          Tomas