With an in-depth study of the integration of Spry features into Dreamweavse CS3, some of the functional modules of the spry framework are understood and mastered, with the ability to easily display XML data to an HTML page through Dreamweavse CS3 visualization.
Of course, when it comes to how to insert XML data into an HTML page, it's often an immediate thought of data island. Like what:
<xml id= "blog" > <blog> <title>test xml</title> <atime>2007/5/1</atime> <cont>content is ...</cont> </blog> </xml> <table datasrc= "#blog" width= "100%" > <tr > <td>title</td> <td>atime</td> <td>content</td> </tr> <t r> <td><span datafld= "title" ></span></td> <td><span datafld= "Atime" ></ span></td> <td><span datafld= "cont" ></span></td> </tr> </table>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Of course, you can also use XSLT to display XML to a page, but now with the Dreamweaver CS3 integrated spry feature, it's easy to embed XML data into HTML, while also making XML data reordering and timed data updates and no refresh displays. Standard spry AJAX applications.
1,xml Data file: Site.xml
<?xml version= "1.0" encoding= "Utf-8"?> <mysite> <site> <name>CNBRUCE</name> <url>http://www.cnbruce.com</url> <desc>cnbruce ' s blog</desc> <atime>2003</atime> </site> <site> <name>DW8</name> <url>http://www.dw8.cn</url> <desc>about Dreamweaver and Web</desc> <atime>2006</atime> </site> <site> <name>164</name> <url>http://www.164.cc</url> <desc>music blog</desc> <atime>2005</atime> </site> </mysite>
|
Http://www.cnbruce.com/test/spry/site.xml
2, add "Spry XML Date Set" in Dreamweaver CS3
3, open the dialog box to browse the selection of XML data source, and then click Get Schema to extract the XML node display, select the node within "Row element" to automatically obtain "XPath" (Note: When you choose different XPath, the final display of information is not the same), in the "Sort" column to select the sorting of the reference node, For example, select the time in descending or ascending order, in "Options" you can set the automatic update of the XML data and is no refresh mechanism display.
4, once the XML data is bound, the XML data (loop) can be displayed in the HTML page.
In general, it's easy to get started, and looking at code in the Code view is concise, and all of the work is done with the spry framework.
Test Address: http://www.cnbruce.com/test/spry/site.html
However, the current issues and considerations are:
1, the data source for the Chinese XML node is not very well supported
2,xml hyperlinks in HTML don't seem to be open.
3, you need to solve the problem of remote XML data source, which is similar to the function of RSS aggregation