430 likes | 544 Views
HTML5 AND CSS Seventh Edition. Chapter 12 Creating and Using XML Documents. Chapter Objectives. Describe how XML differs from HTML Describe an XML document instance, and rules for creating a well-formed and valid XML document
E N D
HTML5 AND CSSSeventh Edition Chapter 12 Creating and UsingXML Documents
Chapter Objectives • Describe how XML differs from HTML • Describe an XML document instance, and rules for creating a well-formed and valid XML document • Define the purpose of the processing instruction, the document prolog, and the document instance • Describe an XML Schema Definition (XSD) language file Chapter 12: Creating and Using XML Documents
Chapter Objectives • Create and bind an XSL style sheet file to an XML document • Discuss the uses of an XML data island in Internet Explorer • Discuss the built-in table element methods for displaying an XML document in a table • Create a JavaScript user-defined function to search an XML document Chapter 12: Creating and Using XML Documents
Creating an XML Document Chapter 12: Creating and Using XML Documents
Plan Ahead • Determine what type of XML document you are going to create • Determine the contents of the document • Determine how the document will be displayed Chapter 12: Creating and Using XML Documents
XML vs. HTML5 • The Extensible Markup Language (XML) was developed to provide a way to share all various types of data in one clear and efficient method • XML provides a common format for all types of data that can be used by anyone using software that can read XML • The HTML document displays the data Chapter 12: Creating and Using XML Documents
Designing XML Documents • XML uses tags to describe the structure of a document and its contents • Formatting XML documents for display on a Web page requires binding or linking a style sheet to the XML document, which formats the elements of the XML document as they appear in a browser • Extensible Stylesheet Language (XSL) is used to create style sheets for formatting structured XML data Chapter 12: Creating and Using XML Documents
XML Standards Chapter 12: Creating and Using XML Documents
XML Standards Chapter 12: Creating and Using XML Documents
Syntax Rules Chapter 12: Creating and Using XML Documents
Creating a Well-Formed XML Document Chapter 12: Creating and Using XML Documents
Creating an XML Schema Definition • An XML Schema Definition describes the structure of an XML document, which includes the data types • string, integer, decimal, date, boolean, binary, anyURI • XML Schema Definitions are XML files, and as such, they must conform to the same rules that any XML document must follow Chapter 12: Creating and Using XML Documents
Creating an XML Schema Definition Chapter 12: Creating and Using XML Documents
Creating an XML Schema Definition Chapter 12: Creating and Using XML Documents
Entering the Code for the Prolog, Root, Annotation, and Documentation Elements Chapter 12: Creating and Using XML Documents
Defining the Parent Element Chapter 12: Creating and Using XML Documents
Defining and Inserting the Child Elements Chapter 12: Creating and Using XML Documents
Entering Code for the Child Group Elements Chapter 12: Creating and Using XML Documents
Saving and Validating an XML Schema Definition File • Start your browser, type www.w3.org/2001/03/webdata/xsv in the Address box and then press the ENTER key. • Scroll down to find the section that begins with “Use this form only if you are behind a firewall or have a schema to check which is not accessible via the Web” • Click the Browse button and navigate to and select the location of the file to validate Chapter 12: Creating and Using XML Documents
Saving and Validating an XML Schema Definition File • Click the Show warnings and Keep Going check boxes, but not the Check as complete schema check box • Click the Upload and Get Results button. A valid XML Schema Definition will have no error messages Chapter 12: Creating and Using XML Documents
Saving and Validating an XML Schema Definition File Chapter 12: Creating and Using XML Documents
Creating a New XML Document and Entering the Prolog Code Chapter 12: Creating and Using XML Documents
Starting Entering a Document Instance in an XML Document Chapter 12: Creating and Using XML Documents
Finishing Entering a Document Instance in an XML Document Chapter 12: Creating and Using XML Documents
Validating XML and XSD Files • If necessary, activate your browser • Click the Address bar • Type www.corefiling.com/opensource/schemaValidate.html and then press the ENTER key to load the Web page • Click the Browse button next to the XML Schema text box • Navigate to location of the file to validate • Click the Open button • Click the Validate button on the XML Schema Validator to upload the files • When the Web page indicates the XML instance and XML schema are present, click the Click here link to see the results Chapter 12: Creating and Using XML Documents
Validating XML and XSD Files Chapter 12: Creating and Using XML Documents
Starting Creating an XSL Style Sheet Chapter 12: Creating and Using XML Documents
Using XSL Style Sheet Tags • By combining the XSL elements and XML markup tags, an XSL style sheet tells the browser how to transform and format the XML document to display records in paragraph format on the Web page • The for-eachelement makes each element appear in the list Chapter 12: Creating and Using XML Documents
Adding XSL Style Sheet Tags Chapter 12: Creating and Using XML Documents
Linking an XSL Style Sheet to an XML Document Chapter 12: Creating and Using XML Documents
Entering Code to Link an XML Document with an HTML Web Page Chapter 12: Creating and Using XML Documents
Entering Code to Add Navigation Buttons Chapter 12: Creating and Using XML Documents
Entering <tr> Tags and Attribute Values to Bind XML Elements to a Table Chapter 12: Creating and Using XML Documents
Entering Code to Bind an XML Document with an HTML Web Page Chapter 12: Creating and Using XML Documents
Entering Code for the <input> and <button> Elements Chapter 12: Creating and Using XML Documents
Entering Code for the findItem() User-Defined Function Chapter 12: Creating and Using XML Documents
Entering Code to Search the Recordset Values and Build the Output String Chapter 12: Creating and Using XML Documents
Entering Code to Complete the findItem() Function Chapter 12: Creating and Using XML Documents
Entering Code for the keyPressed() Function Chapter 12: Creating and Using XML Documents
Entering Code for the clearField() Function Chapter 12: Creating and Using XML Documents
Chapter Summary • Describe how XML differs from HTML • Describe an XML document instance, and rules for creating a well-formed and valid XML document • Define the purpose of the processing instruction, the document prolog, and the document instance • Describe an XML Schema Definition (XSD) language file Chapter 12: Creating and Using XML Documents
Chapter Summary • Create and bind an XSL style sheet file to an XML document • Discuss the uses of an XML data island in Internet Explorer • Discuss the built-in table element methods for displaying an XML document in a table • Create a JavaScript user-defined function to search an XML document Chapter 12: Creating and Using XML Documents
HTML5 AND CSSSeventh Edition Chapter 12 Complete