690 likes | 825 Views
Project 12. Creating and Using XML Documents. Project Objectives. Describe an XML document State the syntax rules for a well-formed and valid XML document State the rules for creating a generic identifier (GI) Define document prolog and document instance
E N D
Project 12 Creating and UsingXML Documents
Project Objectives • Describe an XML document • State the syntax rules for a well-formed and valid XML document • State the rules for creating a generic identifier (GI) • Define document prolog and document instance • Describe the purpose of processing instructions Project 12: Creating and Using XML Documents
Project Objectives • Describe the purpose of Document Type Definitions (DTD) • Create and bind a CSS style sheet and an XSL style sheet file to an XML document • Describe the XSL template, for-each, order-by, and value-of elements • Bind an XML document to an HTML Web page Project 12: Creating and Using XML Documents
Project Objectives • Discuss the built-in table element methods • Create a JavaScript user-defined function to search an XML document • Use the onkeypress event handler to accept input from a text box • Define recordset and describe how the EOF property is used Project 12: Creating and Using XML Documents
Introduction • Extensible Markup Language (XML)is a markup language that uses tags to describe the structure of a document and its content, not the format • Extensible Stylesheet Language (XSL)is a language utilized to create style sheets for formatting structured XML data • A parseris 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 Project 12: Creating and Using XML Documents
Design Goals for XML Project 12: Creating and Using XML Documents
Starting Notepad and Creating a New XML Document • Start Notepad, and if necessary, maximize the Notepad window. If the Word Wrap feature is not enabled, click Format on the menu bar and then click Word Wrap to enable it • With the USB drive plugged into your computer, click File on the menu bar and then click Save As on the File menu • If necessary, click the Look in box arrow and then click UDISK (G:) Project 12: Creating and Using XML Documents
Starting Notepad and Creating a New XML Document • Double-click the Project12 folder and then double-click the ProjectFiles folder in the list of available folders • Type bellvideo.xml in the File name text box • Click the Save button in the Save As dialog box Project 12: Creating and Using XML Documents
Starting Notepad and Creating a New XML Document Project 12: Creating and Using XML Documents
Entering the Prolog in an XML Document • Click line 1 • Enter the XML code shown in Table 12-7 on pages HTM 555 and HTM 556 Project 12: Creating and Using XML Documents
Entering the Prolog in an XML Document Project 12: Creating and Using XML Documents
Starting to Enter the Document Instance in an XML Document • Enter the following XML code, beginning on line 18 Project 12: Creating and Using XML Documents
Finishing Entering the Document Instance in an XML Document • Click line 29 • Enter the XML code shown in Table 12-10 on pages HTM 559 and HTM 560 Project 12: Creating and Using XML Documents
Finishing Entering the Document Instance in an XML Document Project 12: Creating and Using XML Documents
Saving the XML Document and Testing in the Browser • With a USB drive plugged into your computer, click File on the menu bar and then click Save • Start your browser. If necessary, click the Maximize button • Click the Address bar • Type g:\Project12\ProjectFiles\bellvideo.xml and then press the ENTER key Project 12: Creating and Using XML Documents
Saving the XML Document and Testing in the Browser Project 12: Creating and Using XML Documents
Correcting the Tag Error and Retesting the XML Document • Click the Notepad button on the taskbar • Click line 38 • Delete the uppercase tag, </MOVIE> • Type </Movie> as the new tag in place of the deleted tag Project 12: Creating and Using XML Documents
Correcting the Tag Error and Retesting the XML Document • Click File on the menu bar and then click Save • Activate the browser • Click the Refresh button on the browser toolbar Project 12: Creating and Using XML Documents
Correcting the Tag Error and Retesting the XML Document Project 12: Creating and Using XML Documents
Creating an External Style Sheet Using CSS • Start a new Notepad document, and if necessary, maximize the window. If the Word Wrap feature is not enabled, click Format on the menu bar and then click Word Wrap to enable it • Click line 1 • Enter the code shown in Table 12-11on page HTM 64 Project 12: Creating and Using XML Documents
Creating an External Style Sheet Using CSS • Click File on the menu bar and then click Save As • Type bellvideo-css.css in the File name text box. If necessary, click UDISK (G:) in the Save in list. Double-click the Project12 folder and then double-click the ProjectFiles folder in the list of available folders • Click the Save button in the Save As dialog box Project 12: Creating and Using XML Documents
Creating an External Style Sheet Using CSS Project 12: Creating and Using XML Documents
Linking an External CSS Style Sheet to an XML Document • Click the Close button to close the bellvideo-css.css file and the Notepad window • Activate the Notepad window containing the XML document, bellvideo.xml • Click the beginning of line 2 Project 12: Creating and Using XML Documents
Linking an External CSS Style Sheet to an XML Document • Press the ENTER key once. Position the insertion point on the blank line created • Type <?xml-stylesheet type="text/css" href="bellvideo-css.css"?> but do not press the ENTER key • Click File on the menu bar and then click Save Project 12: Creating and Using XML Documents
Linking an External CSS Style Sheet to an XML Document Project 12: Creating and Using XML Documents
Testing an XML Document Formatted Using an External CSS Style Sheet • Activate the browser • Click the Refresh button on the Standard Buttons toolbar Project 12: Creating and Using XML Documents
Opening and Saving an XML Document with a New File Name • If necessary, click the Notepad button on the status bar to activate the Notepad window • With the USB drive plugged into your computer, click File on the menu bar and then click Open on the File menu • If necessary, click the Look in box arrow and then click UDISK (G:) • Double-click the Project12 folder and then double-click the ProjectFiles folder in the list of available folders • If necessary, click the Files of type box arrow and then click All Files Project 12: Creating and Using XML Documents
Opening and Saving an XML Document with a New File Name • Double-click bellvideoall.xml in the list of files • With the bellvideoall.xml file open, click File on the menu bar and then click Save As • Type bellvideo-year.xml in the File name text box. If necessary, click • UDISK (G:) in the Save in list. Double-click the Project12 folder and then double-click the ProjectFiles folder in the list of available folders • Click the Save button in the Save As dialog box Project 12: Creating and Using XML Documents
Starting Creating an XSL Style Sheet • Start a new Notepad document from the Start button and, if necessary, maximize the window. If the Word Wrap feature is not enabled, click Format on the menu bar and then click Word Wrap to enable it • Enter the following code, beginning on line 1 Project 12: Creating and Using XML Documents
Adding XML Tags to a Template Element in an XSL Style Sheet • Enter the following code, beginning on line 4 Project 12: Creating and Using XML Documents
Finishing Creating an XSL Style Sheet • Enter the following code, beginning on line 10 Project 12: Creating and Using XML Documents
Saving an XSL Style Sheet • With your USB drive plugged into your computer, click File on the menu bar and then click Save As • Type bellvideo-year.xsl in the File name text box • If necessary, click UDISK (G:) in the Save in list. Double-click the Project12 folder. Double-click the ProjectFiles folder • Click the Save button in the Save As dialog box Project 12: Creating and Using XML Documents
Linking an XSL Style Sheet to an XML Document • Activate the Notepad window containing the XML document, bellvideo-year.xml • Click at the beginning of line 3 • Type <?xml-stylesheet type="text/xsl" href="bellvideo-year.xsl"?> but do not press the ENTER key Project 12: Creating and Using XML Documents
Linking an XSL Style Sheet to an XML Document Project 12: Creating and Using XML Documents
Saving and Testing an XML Document Formatted Using an XSL Style Sheet • With the USB drive plugged into your computer, click File on the menu bar and then click Save • Activate the browser • Click the Address bar • Type g:\Project12\ProjectFiles\bellvideo-year.xml and then press the ENTER key Project 12: Creating and Using XML Documents
Saving and Testing an XML Document Formatted Using an XSL Style Sheet Project 12: Creating and Using XML Documents
Closing the Notepad Window and the XSL Style Sheet • Activate the Notepad window containing the XSL style sheet, bellvideo-year.xsl • Click the Close button on the Notepad title bar Project 12: Creating and Using XML Documents
Creating an HTML Document to Display XML Data in a Table • Activate the Notepad window • With the USB drive plugged into your computer, open the file, bellvideo-table.htm, from the Project12\ProjectFiles folder • Click File on the menu bar and then click Save As Project 12: Creating and Using XML Documents
Creating an HTML Document to Display XML Data in a Table • Type bellvideo-typetable.htm in the File name text box • If necessary, click UDISK (G:) in the Save in list. Double-click the Project12 folder and then double-click the ProjectFiles folder in the list of available folders • Click the Save button in the Save As dialog box Project 12: Creating and Using XML Documents
Creating an HTML Document to Display XML Data in a Table Project 12: Creating and Using XML Documents
Entering Code to Link an XML Document with an HTML Web Page • With the bellvideo-typetable.htm Notepad window active, click line 5 • Type <xml id="dsoVideo" src="bellvideo-type.xml"></xml> but do not press the ENTER key Project 12: Creating and Using XML Documents
Entering Code to Link an XML Document with an HTML Web Page Project 12: Creating and Using XML Documents
Entering Code to Add Navigation Buttons • Click line 16 • Enter the following code and do not press the ENTER key when finished Project 12: Creating and Using XML Documents
Entering the Code to Bind XML Elements to an HTML Table Header • Enter the following code, beginning on line 21 Project 12: Creating and Using XML Documents
Entering the Code to Bind XML Elements to HTML Table Rows • Enter the following code, beginning on line 28 Project 12: Creating and Using XML Documents
Saving the HTML File and Testing the Web Page • With the USB drive plugged into your computer, click File on the menu bar and then click Save • Activate your browser. If necessary, maximize the window • Click the Address bar Project 12: Creating and Using XML Documents
Saving the HTML File and Testing the Web Page • Type g:\Project12\ProjectFiles\bellvideo-typetable.htm and then press the ENTER key • Click the Next Page button • Click the First Page button and then click the Last Page button Project 12: Creating and Using XML Documents
Saving the HTML File and Testing the Web Page Project 12: Creating and Using XML Documents
Creating an HTML Document to Search an XML Document and Display Results • If necessary, click the Notepad button on the taskbar to activate the Notepad window • With the USB drive plugged into your computer, open the file, findmovie.htm, from the Project12\ProjectFiles folder • Click File on the menu bar and then click Save As Project 12: Creating and Using XML Documents
Creating an HTML Document to Search an XML Document and Display Results • Type findmovietitle.htm in the File name text box • If necessary, click UDISK (G:) in the Save in list. Double-click the Project12 folder, and then double-click the ProjectFiles folder in the list of available folders • Click the Save button in the Save As dialog box Project 12: Creating and Using XML Documents