0 Replies Latest reply on Jan 11, 2015 7:01 AM by tgurus

    Easy Way to Modify XML Data? (or Implementing XQuery in DWCS6?)

    tgurus

      Hello -- I am very new to dreamweaver, as well as any advanced sort of web programming... just trying it out

       

      I am stuck on trying to find the shortest, simplest path to modifying a value in an XML data file.  Currently using Spry to display the data in my html file, which is working just fine.

       

      Next step seems simple in theory, but I am finding many ways to skin this cat -- XQuery seems the simplest for what I want to do, but I am not seeing a direct implementation of XQuery for dreamweaver.

       

      All I want to do is read the value from a field (Status) that will either read "In" or "Out" and toggle the value when they click on it in the table.  Needs to update the actual XML file on the server and not a copy on the client side.

       

      Would prefer to just change directly (as seems possible with XQuery) rather than what seems to be the Spry method: read in the whole file, update and write back, but hey whatever works in the fewest lines of code, that's what I'm after (or what's easiest to implement in dreamweaver)

       

      Hoping someone here can point me in the right direction.  The html is below... nothing special about the XML file it references -- I can change to JSON or another format too, if that is easier to deal with in Dreamweaver --not necessarily married to XML as the format of choice, it's just what seemed easy at first

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">

      <head>

      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

      <title>Crew List</title>

      <link href="css/crewlist.css" type="text/css" rel="stylesheet" />

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

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

      <script type="text/javascript">

        var ds1 = new Spry.Data.XMLDataSet("xml/crew-list.xml", "Crew_List/item");

      </script>

      </head>

      <body>

      <div spry:region="ds1" class="crewTable" style="width:1200px">

        <table>

          <tr>

            <th spry:sort="Status"><center>Status</center></th>

            <th spry:sort="Name">Name</th>

            <th spry:sort="Title">Title</th>

            <th>Phone</th>

            <th>EMail</th>

          </tr>

          <tr spry:repeat="ds1">

            <td><center>{Status}</center></td>

            <td>{Name}</td>

            <td>{Title}</td>

            <td>{Phone_Number}</td>

            <td>{EMail}</td>

          </tr>

        </table>

      </div>

      </body>

      </html>