chapter 12 creating and using xml documents html5 and css seventh edition
Post on 24-Dec-2015
233 Views
Preview:
TRANSCRIPT
Chapter 12
Creating and UsingXML Documents
HTML5 AND CSS
Seventh Edition
• 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 2
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 3
Chapter Objectives
Chapter 12: Creating and Using XML Documents 4
Creating an XML Document
• 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 5
Plan Ahead
• 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 6
XML vs. HTML5
• 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 7
Designing XML Documents
Chapter 12: Creating and Using XML Documents 8
XML Standards
Chapter 12: Creating and Using XML Documents 9
XML Standards
Chapter 12: Creating and Using XML Documents 10
Syntax Rules
Chapter 12: Creating and Using XML Documents 11
Creating a Well-Formed XML Document
• 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 12
Creating an XML Schema Definition
Chapter 12: Creating and Using XML Documents 13
Creating an XML Schema Definition
Chapter 12: Creating and Using XML Documents 14
Creating an XML Schema Definition
Chapter 12: Creating and Using XML Documents 15
Entering the Code for the Prolog, Root, Annotation, and Documentation Elements
Chapter 12: Creating and Using XML Documents 16
Defining the Parent Element
Chapter 12: Creating and Using XML Documents 17
Defining and Inserting the Child Elements
Chapter 12: Creating and Using XML Documents 18
Entering Code for the Child Group Elements
• 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 19
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 20
Saving and Validating an XML Schema Definition File
Chapter 12: Creating and Using XML Documents 21
Saving and Validating an XML Schema Definition File
Chapter 12: Creating and Using XML Documents 22
Creating a New XML Document and Entering the Prolog Code
Chapter 12: Creating and Using XML Documents 23
Starting Entering a Document Instance in an XML Document
Chapter 12: Creating and Using XML Documents 24
Finishing Entering a Document Instance in an XML Document
• 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 resultsChapter 12: Creating and Using XML Documents 25
Validating XML and XSD Files
Chapter 12: Creating and Using XML Documents 26
Validating XML and XSD Files
Chapter 12: Creating and Using XML Documents 27
Starting Creating an XSL Style Sheet
• 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-each element makes each element appear in the list
Chapter 12: Creating and Using XML Documents 28
Using XSL Style Sheet Tags
Chapter 12: Creating and Using XML Documents 29
Adding XSL Style Sheet Tags
Chapter 12: Creating and Using XML Documents 30
Linking an XSL Style Sheet to an XML Document
Chapter 12: Creating and Using XML Documents 31
Entering Code to Link an XML Document with an HTML Web Page
Chapter 12: Creating and Using XML Documents 32
Entering Code to Add Navigation Buttons
Chapter 12: Creating and Using XML Documents 33
Entering <tr> Tags and Attribute Values to Bind XML Elements to a Table
Chapter 12: Creating and Using XML Documents 34
Entering Code to Bind an XML Document with an HTML Web Page
Chapter 12: Creating and Using XML Documents 35
Entering Code for the <input> and <button> Elements
Chapter 12: Creating and Using XML Documents 36
Entering Code for the findItem() User-Defined Function
Chapter 12: Creating and Using XML Documents 37
Entering Code to Search the Recordset Values and Build the Output String
Chapter 12: Creating and Using XML Documents 38
Entering Code to Complete the findItem() Function
Chapter 12: Creating and Using XML Documents 39
Entering Code for the keyPressed() Function
Chapter 12: Creating and Using XML Documents 40
Entering Code for the clearField() Function
• 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 41
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 42
Chapter Summary
Chapter 12 Complete
HTML5 AND CSS
Seventh Edition
top related