How to embed XML data in an HTML page

Embedding xml data in an html page can be done through a concept called data islands. These are supported by the <xml> tag that is used to embed the data source in the html file. For example if you are going to embed an xml file called books.xml in to an html page then, you can use a code similar to,

<xml id="bksrc" src="books.xml"></xml>

After writing this code the contents of the books.xml file is embedded in the html page. But this content is not visible to the use at present. You have to write the code to display the content that is embedded in the web page. You can do so by,

<table border="1" datasrc="#bksrc">
<tr>
<td><span datafld="author"></span></td>
<td><span datafld="title"></span></td>
</tr>
</table>

The above table uses the datasrc as the id given in the xml tag so that the content of the books.xml file is available to the table. The datafld attribute is used in the <span> tag to display text in the author and the title elements in the xml file.



SetApp - 100 Apps for everything you ever wanted to do on Mac

FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________






 

 

FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.

 

 

Add to My Yahoo!

Visit XML Training Material Guide Homepage

 

 

“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

Copyright - © 2004 - 2019 - All Rights Reserved.