Dreamweaver CS3 to display XML data to an HTML page with spry

Source: Internet
Author: User
Tags xpath dreamweaver

Use spry to easily display XML data to an HTML page

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>
<tr>
  <td><span datafld="title"></span></td>
  <td><span datafld="atime"></span></td>
  <td><span datafld="cont"></span></td>
</tr>
</table>

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>

2, add "Spry XML Date Set" in Dreamweaver CS3

3, open the dialog box to browse to select an XML data source, and then click Get Schema to extract the XML node display, in the "Row element" selection of nodes automatically obtained "XPath" (Note: When you choose different XPath, the final display of information is not the same), in the " The sort column selects the reference node for sorting, such as descending or ascending of the selection time, in which you can set up automatic updates of the XML data and are displayed without a refresh mechanism.

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.

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.