XML Data Island, XML Tutorial, Global Guideline

Bookmark Bookmark: XML Data Island, XML Tutorial
Forum | Directory | Blog


      Home                    

Basic XML Guide.       
 XML Introduction.       
 XML Tags Guide.       
 XML Attributes.           
 XML Syntax Guide.    
 XML Compilation.      
 XML Execution.          
 XML with CSS.           
 XML with XSL.            
 XML Data Island.
 XML Professional.       
 XML with JavaScript. 
 XML Namespaces.      
 XML CDATA.              
 XML Editors.               
 XML Summary.           


Submit your link

XML Tutorial >> XML Data Island.


     Back             Next     



We can embed some kind of files like audio flash etc.  And the same, we can embed and XML file and this is happen with <xml> element.  Process of this file ambition is called XML Data Island. In this procedure we will use an external XML document and use it as we use the CSS and XSL.  For example we have following XML document.

XML for Data Island Example.

<?xml version="1.0" encoding="ISO-8859-15"?>
   <globalGuideLine>
       <employee>
          <FirstName>Austin</FirstName>
          <LastName>Hennery</LastName>
          <gender>m</gender>
       </employee>
       <employee>
           <FirstName>Angela</FirstName>
           <LastName>Julie</LastName>
           <gender>f</gender>
       </employee>
       --------
       --------
  </globalGuideLine>

Now and other HTML file will use the above Employees XML.  In HTML we will use <xml> tag to define an XML Data Island and for this purpose we have two attributes in HTML <xml> tag, one is its id and second is its source, as we use a source of any CSS or XSL.  ID attribute will be use in other HTML tags to retrieve data from XML document   To retrieve data we will bind the ID of xml tag to the HTML tags as shown in below example of HTML.

HTML using XML as Data Island.

<html>
  <head>
     <title>XML Tutorial, HTML Document using XML as Data Island</title>
  </head>
  <body>
     <xml id="ID_XML_employee" src="employee.xml"><.xml>

     <table border=1 cellspacing=2 width=100% datasrc="#ID_XML_employee">
          <tr>
               <td>
                   <span datafld="FirstName"></span>
               </td>
               <td>
                   <span datafld="LastName"></span>
               </td>
               <td>
                   <span datafld="gender"></span>
               </td>
          </tr>
     </table>

  </body>
</html>

On the above HTML code we can see that we have first created an id of XML document with the <xml> tag and define its source file with an attribute of "src" then we start a table and bind it with its an attribute of "datasrc".  This attribute will bound the entire data of XML document with HTML table and for display it we again need to specify each element of XML document that's why we use the <span> tag in table <td>, table <td> tag have no any attribute to bind itself with XML data so we used span tag and the span tag have an attribute of "datafld" to specify Data Field we will use this attributes as we know in our Employees XML we have three elements FirstName LastName and gender that's why we have used three <span> tags and bind them with one by one XML elements.  For more details you can click here for HTML document and see its view source, here you will see how to make more formatting with XML Data Island and express it as good as you can.  Look a external Employees XML document here.

If you are using Mozilla Firefox or other browsers except Microsoft Internet Explorer then the output for some examples could not visible but when you try to view source you can see the entire Source for that example and to get full out put we recommend you to please view these examples in Microsoft Internet Explorer and it is better to use IE version 5.5 or 6 is recommended for the best output.


     Back             Next     
 

[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright 2005 -  2014 www.globalguideline.com All rights reserved. (Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher) 416 visitors are online now