html5 and css seventh edition

43
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition

Upload: alair

Post on 23-Feb-2016

36 views

Category:

Documents


0 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: HTML5  AND CSS Seventh Edition

Chapter 12

Creating and UsingXML Documents

HTML5 AND CSS

Seventh Edition

Page 2: 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

Page 3: HTML5  AND CSS Seventh Edition

• 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

Page 4: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 4

Creating an XML Document

Page 5: HTML5  AND CSS Seventh Edition

• 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

Page 6: HTML5  AND CSS Seventh Edition

• 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

Page 7: HTML5  AND CSS Seventh Edition

• 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

Page 8: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 8

XML Standards

Page 9: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 9

XML Standards

Page 10: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 10

Syntax Rules

Page 11: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 11

Creating a Well-Formed XML Document

Page 12: HTML5  AND CSS Seventh Edition

• 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

Page 13: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 13

Creating an XML Schema Definition

Page 14: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 14

Creating an XML Schema Definition

Page 15: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 15

Entering the Code for the Prolog, Root, Annotation, and Documentation Elements

Page 16: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 16

Defining the Parent Element

Page 17: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 17

Defining and Inserting the Child Elements

Page 18: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 18

Entering Code for the Child Group Elements

Page 19: HTML5  AND CSS Seventh Edition

• 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

Page 20: HTML5  AND CSS Seventh Edition

• 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

Page 21: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 21

Saving and Validating an XML Schema Definition File

Page 22: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 22

Creating a New XML Document and Entering the Prolog Code

Page 23: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 23

Starting Entering a Document Instance in an XML Document

Page 24: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 24

Finishing Entering a Document Instance in an XML Document

Page 25: HTML5  AND CSS Seventh Edition

• 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

Page 26: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 26

Validating XML and XSD Files

Page 27: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 27

Starting Creating an XSL Style Sheet

Page 28: HTML5  AND CSS Seventh Edition

• 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

Page 29: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 29

Adding XSL Style Sheet Tags

Page 30: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 30

Linking an XSL Style Sheet to an XML Document

Page 31: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 31

Entering Code to Link an XML Document with an HTML Web Page

Page 32: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 32

Entering Code to Add Navigation Buttons

Page 33: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 33

Entering <tr> Tags and Attribute Values to Bind XML Elements to a Table

Page 34: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 34

Entering Code to Bind an XML Document with an HTML Web Page

Page 35: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 35

Entering Code for the <input> and <button> Elements

Page 36: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 36

Entering Code for the findItem() User-Defined Function

Page 37: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 37

Entering Code to Search the Recordset Values and Build the Output String

Page 38: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 38

Entering Code to Complete the findItem() Function

Page 39: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 39

Entering Code for the keyPressed() Function

Page 40: HTML5  AND CSS Seventh Edition

Chapter 12: Creating and Using XML Documents 40

Entering Code for the clearField() Function

Page 41: 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 41

Chapter Summary

Page 42: HTML5  AND CSS Seventh Edition

• 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

Page 43: HTML5  AND CSS Seventh Edition

Chapter 12 Complete

HTML5 AND CSS

Seventh Edition