New Perspectives on XML - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

New Perspectives on XML

Description:

... is to assign the method to the onClick event handler of a button as shown below: button onClick='Staff_Info.recordset.moveLast( )' New Perspectives on XML ... – PowerPoint PPT presentation

Number of Views:50
Avg rating:3.0/5.0
Slides: 14
Provided by: willa45
Category:

less

Transcript and Presenter's Notes

Title: New Perspectives on XML


1
  • Tutorial 2.2
  • Data Binding with Element Attributes

2
Binding to an XML Attribute
  • Attributes, like the Status attribute of the
    Employee element, are treated by the DSO as
    fields. If the attribute is part of a record
    element, it is easy to bind attribute values to a
    Web page.

3
Binding to an XML Attribute
  • This code has the ID attribute as part of the
    Employee element
  • ltEmployee IDE304gt
  • ltNamegtAlice Ashmanlt/Namegt
  • ltDepartmentgtAccountinglt/Departmentgt
  • lt/Employeegt

4
Binding to an XML Attribute
  • And it is interpreted by the DSO as
  • ltEmployeegt
  • ltIDgtE304lt/IDgt
  • ltNamegtAlice Ashmanlt/Namegt
  • ltDepartmentgtAccountinglt/Departmentgt
  • lt/Employee
  • If the attribute is part of a field element, it
    is still treated by the DSO as a field element.

5
Binding to an XML Attribute
  • The field element containing the attribute
    becomes a record element.
  • Remember to reference all character data within
    an element using the Text field.
  • It is a good idea not to use attributes in field
    elements if you plan to do data binding.

6
Binding to an XML Attribute
  • This figure shows STAFF_INFO data displayed in
    the Web page


bound element
bound element
7
The Data Source Object
  • ActiveX Data Objects (ADO) is a data-access
    technology developed by Microsoft. ADO allows you
    to work with the Data Source Object by applying a
    method or by changing one of the properties of
    the DSO.
  • The syntax for applying a method is
  • id.recordset.method

8
The Data Source Object
  • Here, id is the name of the data island in the
    Web document and method is the name of the method
    supported by ADO.
  • There are several methods that can be applied to
    DSOs.

9
The Data Source Object
  • This figure shows a few available recordset
    methods

10
The Data Source Object
  • For example, if you want to display the last
    record in a DSO whose id is Staff_Info, run the
    following method
  • Staff_Info.recordset.moveLast( )
  • The simplest way to run a method is to assign the
    method to the onClick event handler of a ltbuttongt
    as shown below
  • ltbutton onClickStaff_Info.recordset.moveLast(
    )gt

11
The Data Source Object
  • When the user clicks the button, IE runs the
    command indicated by the onClick event handler,
    displaying the last record.

12
Assigning a Recordset Method
  • This figure shows how to enter the movefirst( )
    method

13
Assigning a Recordset Method Continued
  • This figure shows how to enter the remaining
    recordset methods
Write a Comment
User Comments (0)
About PowerShow.com