XML Considerations
Here are the technologies you should avoid when using XML.
Internet Explorer - XML Data Islands
What is it? XML Data Islands are XML data embedded in an HTML page.
Why avoid it? XML Data Islands only work in Internet Explorer.
What to use instead? You should use JavaScript and XML DOM to parse and display XML in HTML.
For more information on JavaScript and XML DOM, visit our XML DOM Tutorial.
XML Data Island Example
This example uses the XML document "cd_catalog.xml".
Bind the XML document to an <xml> tag in the HTML document. The id attribute defines the identifier for the data island, and the src attribute points to the XML file:
Example
This example only works in IE browsers
The datasrc attribute of the <table> tag binds the HTML table to the XML data island.
The <span> tag allows the datafld attribute to reference the XML element to be displayed. In this example, it references "ARTIST" and "TITLE". When reading the XML, a corresponding table row is created for each <CD> element.
Internet Explorer - Behaviors
What is it? Internet Explorer 5 introduced behaviors. Behaviors are a way to add behavior to XML (or HTML) elements by using CSS styles.
Why avoid it? Only Internet Explorer supports the behavior attribute.
What to use instead? Use JavaScript and XML DOM (or HTML DOM) instead.
Example 1 - Highlight on Hover
The <style> element in the following HTML file defines a behavior for the <h1> element:
The following shows the XML document "behave.htc" (which contains JavaScript and event handlers for the element):
Example 2 - Typewriter Simulation
The <style> element in the following HTML file defines a behavior for the element with id "typing":
The following shows the XML document "typing.htc":