Presentation is loading. Please wait.

Presentation is loading. Please wait.

Embedding XML in HTML: Using Data Islands Eugenia Fernandez IUPUI.

Similar presentations


Presentation on theme: "Embedding XML in HTML: Using Data Islands Eugenia Fernandez IUPUI."— Presentation transcript:

1 Embedding XML in HTML: Using Data Islands Eugenia Fernandez IUPUI

2 Internet Explorer 5 Approach Treats XML as a Data Source Object or DSO, also referred to as a data island Handles symmetric data best, i.e. data that resembles a relational table Can use multiple data islands in same HTML file Each data island requires unique ID

3 Defining a Data Island A data island is defined within the and HTML tags. –explicitly, by embedding XML data directly –implicitly, by reference to external XML file some XML

4 Mapping XML Data to an ADO Recordset XML data within an XML data island is treated as an ADO recordset. Each main element maps to a record in the ADO recordset, and each child element maps to a field in the record.

5 ADO Mapping Example The Autobiography of Benjamin Franklin Benjamin Franklin 8.99 The Confidence Man Herman Melville 11.99 TitleAuthorPrice The Autobiography of Benjamin Franklin Benjamin Franklin8.99 The Confidence ManHerman Melville11.99

6 Binding Data Islands to HMTL Elements Individual fields can be bound to HTML tags using the DATASRC and DATAFLD attributes –DATASRC specifies the ID of the XML data island. The ID must be preceded with #. –DATAFLD specifies the XML field from which data is taken.

7 HTML Elements That Support DSO Binding A APPLET BUTTON DIV FRAME IFRAME INPUT (where TYPE = CHECKBOX, HIDDEN, LABEL, PASSWORD, RADIO, TEXT) IMG LABEL MARQUEE SELECT SPAN TABLE TEXTAREA

8 Displaying Data in HTML Tables Use a TABLE to display multiple rows of data. Set the DATASRC in the TABLE tag. For each TD, include an HTML element and set its DATAFLD attribute The data binding agent automatically populates multiple rows, for each record in the XML dataset.

9 Paging the DSO Data For large XML data islands, DSO allows the data to be displayed in pages. The size of the page is set through the DATAPAGESIZE attribute in the TABLE tag.

10 Accessing Repeating XML Elements Use a nested table to access repeating XML elements Gourmet Microwave Cooking 18.99 Charlotte Waves Regina Cooker Mario Gourd

11 Accessing XML Attributes XML attributes are treated as child elements The Autobiography of Benjamin Franklin Benjamin Franklin 8.99 The Confidence Man Herman Melville 11.99

12 Navigating the DSO Recordset You can navigate through your DSO Recordset by adding script to call the ADO move methods: –Move, MoveFirst, MoveLast, MoveNext, MovePrevious Example xmldso.recordset.MoveNext

13 Adding Navigation Add a field to display the data Add a button to invoke the desired move method. Title:

14 Adding Navigation, cont. Set an onclick event procedure for the button that calls the move command. Sub btnNext_onclick() xmldso.recordset.MoveNext End Sub

15 Sources “Building XML-Based Web Applications” a Microsoft Certified Course.


Download ppt "Embedding XML in HTML: Using Data Islands Eugenia Fernandez IUPUI."

Similar presentations


Ads by Google