How to apply XML data in Web design 2

Source: Internet
Author: User
Code List 2: <! --Example2.htm -->
<! -- Example2.htm -->
<Html>
<Head>
<Title> XML DSO-example2.htm </title>
</Head>
<Body bgcolor = '# ffff'>

<Xml id = 'xmldb'>
<Db>
<Member>
<Name> Premshree Pillai <name>
<***> Male </***>
</Member>
<Member>
<Name> Vinod </name>
<***> Male </***>
</Member>
</Db>
</Xml>

<Table datasrc = '# xmldb' border = '1'>
<Thead>
<Th> Name </th>
<Th> Sex </th>
</Thead>
<Tr>
<Td> <div Dataworks = 'name'> </div> </td>
<Td> <div Dataworks = *** '> </div> </td>
</Tr>
</Table>

</Body>
</Html>

Extract data from external XML files

To apply the XML-DSO to load an external XML file, you must explicitly include this object and apply some JavaScript.

First create a XML-DSO object, application ID myXML. Add the width and height attributes to the <OBJECT> tag and set them to 0. This ensures that XML-DSO objects do not reside in any space on your web page.

Second, use datasrc to create a table like myXML-similar to that in Code List 2. The code application uses the <DIV> tag (marked in TD) to extract data, the application Dataworks is used as the information in the first column, and the application URL is used as the second column. Add the <SCRIPT> tag because the external XML application Java SCRIPT explicitly declares the XML file you want to load.

Set xmlDso to myXML. XMLDocument. MyXML references your created object. Next, load example3.xml using the load () method of the XML-DSO. File example3.xml is connected to the object myXML.

<! -- Example3.xml -->
<? Xml version = '1. 0'?>
<Ticker>
<Item>
<Message> JavaScript Ticker using xml dso </message>
<URL> http://someURL.com </URL>
</Item>
</Ticker>


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.