| |
| Overview |
| |
| In this chapter you will learn : |
- How to embed XML into HTML?
- What are the various ways to get XML data source?
- What is Data Binding?
|
XML can be used to store data inside HTML documents. XML data can be stored inside HTML pages as "Data Islands". As HTML provides a way to format and display the data, XML stores data inside the HTML documents. The data contained in an XML file is of little value unless it can be displayed, and HTML files are used for that purpose.
The simple way to insert XML code into an HTML file is to use the <xml> tag. The XML tag informs, the browser that the contents are to be parsed and interpreted using the XML parser. Like most other HTML tags, the <xml> tag has attributes. The most important attribute is the ID, which provides for the unique naming of the code. The contents of the XML tag come from one of two sources : inline XML code or an imported XML file.
- If the code appears in the current location , it's said to be inline.
| Example |
Embedding XML code inside an HTML File.
<html>
<xml Id = msg>
<message>
<to> Visitors </to>
<from> Author </from>
<Subject> XML Code Islands </Subject>
<body> In this example, XML code is embedded inside HTML code </body>
</message>
</xml>
</html> |
- The efficient way is to create a file and import it. You can easily do so by using the SRC attribute of the XML tag.
| Syntax |
<xml Id = msg SRC = "example1.xml">
</xml> |
Data Binding
Data binding involves mapping, synchronizing, and moving data from a data source, usually on a remote server, to an end user's local system where the user can manipulate the data. Using data binding means that after a remote server transmits data, the user can perform some minor data manipulations on their own local system. The remote server does not have to perform all the data manipulations nor repeatedly transmit variations of the same data.
Data binding involves moving data from a data source to a local system, and then manipulating the data, such as, searching, sorting, and filtering, it on the local system.
-
When you bind data in this way, you do not have to request that the remote server manipulate the data and then retransmit the results; you can perform some data manipulation locally.
-
In data binding, the data source provides the data, and the appropriate applications retrieve and synchronize the data and present it on the terminal screen.
-
If the data changes, the applications are written so they can alter their presentation to reflect those changes.
-
Data binding is used to reduce traffic on the network and to reduce the work of the Web server, especially for minor data manipulations.
-
Binding data also separates the task of maintaining data from the tasks of developing and maintaining binding and presentation programs.
| |
| Summary |
| |
In this chapter you have learnt
- Embedding of XML into HTML.
- Various sources of content for XML tag.
- About data binding.
|
| |
| Review Questions |
| |
Fill in the Blanks
- When XML data is stored inside HTML pages, it is called as _________.
- The XML code can be inserted into an HTML file with the use of ______ tag.
- ______ attribute of XML tag provides for the unique naming of the code.
- The XML data can be placed as _______ or as an _______ file.
- ______ allows browser to retrieve data from the database.
Solutions
- Data Islands
- <XML>
- ID
- inline, imported XML
- Data binding
|
| |
| What's Next |
The next chapter will acquaint you with the basic concepts of working with XML parser. The chapter will further elucidate about various types of parsers available and loading of XML file in browser and the concepts of unicode.
Hop over to the next chapter to get a close-up of XML Parsers. |
| |
|
| |
|