Developing XML Solutions (DV-MPS General)

[Previous] [Next]

The XML DSO allows you to bring data over to the client as XML and then manipulate the XML data directly on the client. As mentioned earlier in the chapter, the XML DSO is a Microsoft technology available in Internet Explorer 5.

NOTE


The XML DSO does not make or maintain any connection to a data source. Therefore, any changes that are made to the XML data on the client will not be reflected on the server. To update a data store on the server, a special application would have to be written that could read the updated XML data and then update the data source. Writing such an application is very difficult. A better method to update the data is to use Microsoft's Remote Data Services (RDS) control, which is designed for both reading and updating data on the server. The RDS can connect directly to a database using either a SQL string or a stored procedure.

The XML DSO allows you to work with XML data that is embedded directly in your HTML code. This embedded XML code creates data islands.

To create a data island, you will use the new HTML xml element. This element is not part of the W3C HTML standard. Only Internet Explorer 5 recognizes the xml element. The DSO will find the data located in the xml element and use it as a data island. The xml element includes an id attribute that will be used to reference the data island. The xml element looks as follows:

<xml id="orderDSO"> <!--XML data goes here --> </xml>

You can also reference XML data in an external XML document by using the xml element and the src attribute as follows:

<xml id="orderDSO" src="NorthwindOrder.xml"></xml>

As mentioned above, the XML DSO gives you the ability to read and manipulate XML data islands. You can also bind certain form elements to XML data using the XML DSO, which means that the data in the XML DSO will be displayed in the element. Once an element is bound to XML data using the XML DSO, any manipulation of the data you make using the XML DSO will be reflected in the elements that are bound to the XML Data. This will greatly simplify your coding of Web-based user services components. Let's begin by looking at how to bind HTML elements to XML data using the XML DSO.

Binding HTML Elements to XML Data Using the XML DSO

Once you have created a reference to an XML data source using the xml element, you can bind this data to some of the HTML elements in a document. With some of the elements, you can display the content that is within the element as either text or as HTML. You would display it as HTML when the content contains HTML elements that you want to be rendered as HTML. The following elements can be bound to XML data using the XML DSO in Internet Explorer 5:

HTML ElementBound Property
ahref
applet*param
button**innertext, innerhtml
div**innertext, innerhtml
framesrc
iframesrc
imgsrc
input* type=checkboxchecked
input* type=hiddenvalue
input* type=labelvalue
Input* type=passwordvalue
input* type=radiochecked
input* type=textvalue
label**innertext, innerhtml
marquee**innertext, innerhtml
object*param
select*option
span**innertext, innerhtml
table
text*value

* Content in this element can be updated

** Element can be displayed as HTML

The table element is the only HTML element that allows tabular data binding. Tabular data binding allows you to bind all the content of an element in an XML document.

Категории