How to use spry to easily display XML data to an HTML page _xml sample

Source: Internet
Author: User
Tags html page xpath
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.