890 likes | 1.19k Views
Introduction. Extensible Markup Language (XML) Uses tags to describe the structure of a document Simplifies the process of sharing information Extensible Stylesheet Language (XSL) XML is a subset of Standard Generalized Markup Language. Introduction. Introduction. Introduction.
E N D
Introduction • Extensible Markup Language (XML) • Uses tags to describe the structure of a document • Simplifies the process of sharing information • Extensible Stylesheet Language (XSL) • XML is a subset of Standard Generalized Markup Language
Introduction • Documents must be well-formed • Must adhere to the basic syntax rules for XML and contain at least one root element • A parser is an XML processor that verifies the document follows the syntax rules for a well-formed document and converts the document into a tree of elements
Creating a Well-Formed XML Document • Prolog • Contains declaration and processing instruction statements • Document instance • Contains the main content or elements of the XML document • Processing instruction • One or more instructions passed to the application using the XML document • XML declaration • Processing instruction statement identifying the version of XML used in the document
Creating a Well-Formed XML Document • Document type declaration • A processing instruction that tells the processor where to locate the Document Type Definition • Document Type Definition (DTD) • Defines the elements and attributes in an XML document • Validity of XML documents • Instance • Occurrence of XML elements • Root element • The main element in an XML document
Creating the Document Instance in an XML Document • Generic Identifier (GI) • The name that a developer provides for the tags • Namespace • A unique identifier or prefix used to identify tags that have the same name • Relation • A collection of data • Schema • States the relation name and follows with a list of attributes or fields in parentheses
Linking a Cascading Style Sheet to Format an XML Document • Makes XML easier to read • Start a new Notepad document • Click line 1 • Enter the code shown on the following slide
Formatting and Manipulating an XML Document Using an XSL Style Sheet • Extensible Stylesheet Language • Binding XML documents to HTML Web pages
Formatting and Manipulating an XML Document Using an XSL Style Sheet • Transforming an XML document • The XSL style sheet tells the browser or parser to output the XML document in a completely different form, such as HTML • Source • Result tree
Creating an XSL Style Sheet • Stylesheet element • Establishes a namespace, so the remaining elements can use names that will not be confused with other elements
Creating an XSL Style Sheet • Template • An instruction that identifies which elements in a document should be transformed, and how they should be transformed
Adding XML Tags to a Template Element in an XSL Style Sheet • Click line 4 • Enter the code shown on the following slide
Adding XML Tags to a Template Element in an XSL Style Sheet • for-each element • Makes each element of the XML document display in the table
Adding XML Tags to a Template Element in an XSL Style Sheet • value-of element • Defines the display for each element within the PHONELIST
Saving an XSL Style Sheet • With your HTML Data Disk in drive A, click File on the menu bar and then click Save As. Type xslalphaclublist.xsl in the File name text box. Save to the Project 11 folder on your HTML Data Disk
Linking an XSL Style Sheetto an XML Document • Activate the Notepad window containing the XML document, clublist.xml • Click line 3 • Type <?xml-stylesheet type=“text/xsl” href=“xslalphaclublist.xsl”?> but do not press the ENTER key
Saving and Testing an XML Document Formatted Using an XSL Style Sheet • With your HTML Data Disk in drive A, click File on the menu bar and then click Save As. Type clublist-xsl.xml in the File name text box. Save to the Project 11 folder on your HTML Data Disk • Activate the browser • Click the Address bar. Type a:\Project 11\clublist-xsl.xml and then press the ENTER key
Closing the Notepad Window Containing the XSL Style Sheet • Activate the Notepad window containing the XSL style sheet, xslalphaclublist.xsl • Click the Close button on the Notepad title bar
Using Paging to Display XML Data in a Table • Data binding • Mapping the XML elements to a data format that preserves the hierarchy of the data and allows the data to be manipulated using different methods
Using Paging to Display XML Data in a Table • Data island • A set of data elements separate from the main HTML Web page • Data Source Object (dso) • Recordset • A collection of data records and their fields
Creating an HTML Document to Display XML Data in a Table • Activate the Notepad Window containing the XML document, clublist-xsl.xml • With the HTML Data Disk in drive A, open the file, clubsponsor.htm • Save this file to the Project 11 Folder on your Data Disk with the name, clubsponsor-table.htm
Entering Code to Bind an XML Document with an HTML Web Page • With the clubsponsor-table.htm Notepad window active, click line 6 • Type <XML ID=“dsoClub” SRC=“clublist.xml”></XML> but do not press the ENTER key
Entering Code to Add Navigation Buttons • Click line 12 • Enter the following code: