101
Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Embed Size (px)

Citation preview

Page 1: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

XML Document Design

Page 2: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 1:Introduction to XML

Page 3: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Explain the basic concepts of markup languages

• List the goals of XML• Describe the relationship between XML and

HTML• Name the organizations that govern and

contribute to XML development• Define XHTML• Identify browsers that support XML

Page 4: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

WhatIs XML?

• Extensible Markup Language• Hypertext Markup Language• Tags <golfer tour=“PGA”> Tiger Woods </golfer>

Page 5: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

MarkupLanguages

• Markup• WYSIWYG

Page 6: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

SGMLRoots

• STML and HTML– Meta-language

• HTML went astray• HTML tried to recover its vision

– Cascading Style Sheets• SGML and XML

– Extensible Stylesheet Language

Page 7: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XMLDirectives

• Design goals for XML• XML implementation

Page 8: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XHTML,XML and HTML

• Extensible Hypertext Markup Language 1.0– No tags

Page 9: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XMLDevelopment Organizations

• W3C• Oasis• BizTalk• XML.org

• Arbortext• Microsoft XML Web

Services• IBM XML Zone• Apache XML Project

Page 10: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XML Parsersand Browsers

• Parsers– Validating– Non-validating

• Browsers– Mozilla– Microsoft Internet Explorer 6– Opera– Netscape Navigator 7

Page 11: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XML AloneIs Insufficient

• No linking capability• No formatting capabilities• XML documents are abstract

– EDI

Page 12: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Implementing XML

• XML schema• Development tools

Page 13: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Benefitsof XML

• One source• Management of metadata• Universal representation and meaning• Management of content• One to many• Database publishing

Page 14: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Explain the basic concepts of markup languages

List the goals of XML Describe the relationship between XML and

HTML Name the organizations that govern and

contribute to XML development Define XHTML Identify browsers that support XML

Page 15: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 2:Well-Formed

XML Documents

Page 16: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Construct XML documents• Explain the differences between tags and

elements in XML• Specify the five rules for creating a well-

formed XML document• Convert an HTML document into an XHTML

file• Create a well-formed XML document

Page 17: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

What Is an XML Document?

• HTML: The lazy developer’s dream• XML: The lazy developer’s nightmare

Page 18: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Tags andElements in XML

Page 19: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Rules forWell-Formed XML

• Opening and closing tags• New rules for empty tags• Attribute values• Nesting• Matching case between tags• Simple well-formed XML• XHTML: Stepping stone to XML

Page 20: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

TagNesting

Page 21: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

DiscerningStructure

• XML character strings– Character data

• White space• The root (or document) element• Tree structure of a well-formed document

Page 22: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

TreeStructure

T IT LE

AUT HOR

YEAR-PUBLISHED

ISBN

BOOK

CATALOG

Page 23: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Working withMixed Content

• Creating a well-formed XML document from text

• Adding comments to XML documents• XML encoding

Page 24: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Balkanizationof the Web

• Confusing assortment of tags resulting from numerous tagging schemes

Page 25: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Construct XML documents Explain the differences between tags and

elements in XML Specify the five rules for creating a well-

formed XML document Convert an HTML document into an XHTML

file Create a well-formed XML document

Page 26: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 3:Creating a

Valid XML Document

Page 27: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Define the DTD• Define the DOM• Identify DTD declarations• Create a DTD• Validate an XML document• Create an XML file that conforms to a DTD• Use DTD repositories

Page 28: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Beyond Well-Formedness:Valid XML Documents

• Valid conformance with a Document Type Definition– Rules that define the structure, syntax and

vocabulary related to tags

Page 29: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

DocumentObject Model

• Core Level 1• HTML Level 1

Page 30: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

DocumentType Definition

• The root element• Element type declarations

– #PCDATA– Child elements– Element content– Mixed content– Empty elements

Page 31: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Referencing DTDDefinitions in XML

• DOCTYPE declaration• Internal DTD• External DTD

Page 32: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

DeclaringAttributes in a DTD

• Attribute-list declarations• Commonly used attribute types• Entities• Parameter entities• Notation declarations

Page 33: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Pre-Existing DTDs

• XML/DTD repositories

Page 34: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Define the DTD Define the DOM Identify DTD declarations Create a DTD Validate an XML document Create an XML file that conforms to a DTD Use DTD repositories

Page 35: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 4:XML Parsers

Page 36: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Explain the requirements for a parser• Identify the differences between validating and

non-validating parsers• Use online parsers• Use command-line parsers

Page 37: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Parsers

• Also known as processors• Varying levels of conformance• Object-based parsers• Event-based parsers• Validating parsers• Non-validating parsers

Page 38: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Command-LineParsing

• Verifies document compliance with well-formedness requirements and DTD

Page 39: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Explain the requirements for a parser Identify the differences between validating and

non-validating parsers Use online parsers Use command-line parsers

Page 40: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 5:The XML Familyof Technologies

Page 41: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Define XML namespaces and usage• Explain the XPath recommendation• Explain the XLink recommendation• Explain the XPointer recommendation• Describe the XForms and XML Query

proposals

Page 42: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

TheXML Family

• Namespaces in XML• XLink• XPath• XPointer

Page 43: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Namespacesin XML

• Namespace components• Explicit and implicit namespace declaration• Multiple namespaces• Inline namespace declaration• Namespace scope/inheritance• Namespaces and DTDs• Namespace attributes

Page 44: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XPath

• XML Path Language• XPath nodes

– Document– Root– Element– Attribute– Text– Processing instruction– Namespace– Comment

Page 45: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XPathExpressions

• Operand• Location paths

– Context node• Function calls

– Predicate

Page 46: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XLink

• XML Linking Language– Simple links– Extended links– Locators– Arcs– Resources– Titles

• Link behavior

Page 47: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XPointer

• Fragment identifier• Tracing a path• Shorthand notation• Shorthand syntax• Formal XPointer syntax• Range or portion selection

Page 48: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XFormsand XML Query

• XForms– New generation of forms introducing

business logic, calculations, and form processing

• XML Query– Based pm XML Infoset

Page 49: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Define XML namespaces and usage Explain the XPath recommendation Explain the XLink recommendation Explain the XPointer recommendation Describe the XForms and XML Query

proposals

Page 50: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 6:XSL Transformation

Page 51: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Describe the relationship between XSL and XSLT

• Use XSLT templates and patterns• Convert XML to a new XML output document• Reorganize XML data to an output file• Convert XML to HTML• Compile remote data sources into an XML

output file

Page 52: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XSL, XSLTand Style Sheets

• Extensible Stylesheet Language Transformation

• Formatting objects (flow objects)• Transformation languages• XSLT processing• XSLT namespace

Page 53: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XSLTDocument Structure

• Style sheet element and namespace• Templates• apply-templates• select

Page 54: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

TransformingData: XML to XML

• Scenario• Models• Solution• Element transformation

Page 55: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

SaxonXSLT Processor

• Running Saxon• Processing XSLT using Saxon• Converting XML data structure using XSLT

Page 56: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

TransformingData: XML to HTML

• Advanced matching and selecting• Top-level elements• Instruction elements• Comments

Page 57: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

MultipleDocument Sources

• The document () function

Page 58: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Describe the relationship between XSL and XSLT

Use XSLT templates and patterns Convert XML to a new XML output document Reorganize XML data to an output file Convert XML to HTML Compile remote data sources into an XML

output file

Page 59: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 7:XML Formatting

Page 60: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Define XML formatting requirements• Apply CSS to XML• Use XSL flow objects and patterns• Apply XSL to XML• Convert XSL into PDF

Page 61: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XMLStyling

• Cascading Style Sheets• Extensible Stylesheet Language

– Language for transforming XML documents– Vocabulary for specifying formatting

semantics

Page 62: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XMLand CSS

• The absence of predefined formatting eliminates conflicts between inherent element properties and style properties in XML

Page 63: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

CSSSyntax

• Selectors• CSS1• XML and CSS tools

Page 64: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XMLand XSL

• Areas• Indents

Page 65: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

FormattingObjects

• Types– Those that generate block and inline areas– Those that return areas but do not generate

them– Those that are used to generate layout

areas

Page 66: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XSLPage Layout

• fo:layout-master-set• fo:simple-page-master• fo:region• fo:page-sequence-master

and fo:page-sequence• fo:page-sequence-master sub elements• Content flow objects

Page 67: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

PageLayout (cont’d)

• fo:block• fo:list-block• fo:table

Page 68: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XML, XSL andFormatting Objects

• Transforming an XML document• Processing an XSL style sheet

Page 69: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Converting XSLFlow Objects to PDF

• Portable Document Format• Formatting Object Processor

Page 70: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Define XML formatting requirements Apply CSS to XML Use XSL flow objects and patterns Apply XSL to XML Convert XSL into PDF

Page 71: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 8:XML Schemas

Page 72: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Explain the purpose of schemas• Explain data types and facets• Define attributes and references• Define simple and complex elements• Create an XML schema

Page 73: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Schemas

• XML Schema

Page 74: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Components

• Schema component categories– Definition components– Declaration components– Model group components– Annotation component

Page 75: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

DataTypes

• Built-in data types• User-defined data types

Page 76: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

SchemaElement

• The targetNamespace attribute• The elementFormDefault attribute• Document instance schema reference• Undeclared target namespaces• Annotation• Element declarations• Element references

Page 77: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

ComplexTypevs. SimpleType

• ComplexType– Elements that contain sub-elements or

carry attributes• SimpleType

– Elements that contain numbers but do not contain sub-elements or attributes

Page 78: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Attributes

• The content attribute• User-defined attributes

Page 79: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Facets

• Fourteen facets defined by XML Schema

Page 80: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Grouping

Element

Element

Element

Page 81: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Explain the purpose of schemas Explain data types and facets Define attributes and references Define simple and complex elements Create an XML schema

Page 82: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 9:Extensible Hypertext

Markup Language (XHTML)

Page 83: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Identify the reasons for XHTML's development• Identify key features of XHTML documents• Create XHTML documents

Page 84: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

HTML vs. XML

• Clients• Browser forgiveness• What does HTML forgive?

– Case-sensitivity– Nesting– Closing elements– Attributes

• What does XML not forgive?

Page 85: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XHTMLDefinition Variations

• XHTML document declarations– Document type declaration

Page 86: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XHTMLConformance Requirements

• Correct case• Root element• Empty elements• Nesting• Fragment identifiers

Page 87: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XHTML 1.1and Modules

• XHTML 1.1 versus XHTML (Second Edition)• W3C-approved modules for XHTML 1.1• W3C-approved sub-elements for XHTML 1.1• XHTML 2.0 (2003)

Page 88: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Identify the reasons for XHTML's development Identify key features of XHTML documents Create XHTML documents

Page 89: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Copyright © 2002 ProsoftTraining. All rights reserved.

Lesson 10:XML Tools

Page 90: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Objectives

• Use XML tools to clean existing documents• Use a DTD editor• Use an editor to create XSL and schemas• Import database information for XML

conversion• Use graphical editors to create XML

documents• Convert XML to various outputs• Define SOAP and BizTalk

Page 91: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XMLTools

• Simple tools XML Notepad• Complete tools Arbortext Epic,

XML Spy

Page 92: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

ToolTypes

• Command-line tools• Visual tools• Graphical tools

Page 93: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

HTML toWell-Formed XML

• Cleaning an HTML document with TidyGUI

Page 94: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Creatinga DTD

• Creating an XML DTD with SML Spy

Page 95: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Creatinga Schema

• Creating an XML schema with XML Spy

Page 96: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

ImportingDatabase Information

• Importing database data• Editing XML code with Epic Editor• Styles• Creating XSL style sheets• One-to-many output• Creating multiple output files from XML

Page 97: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XML ProjectManagement Guidelines

• Development– Design the required DTD– Develop style sheets– Store in a repository

• Staffing– Project managers– Application developers– Format/layout designers– Content authors

Page 98: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XML-DrivenTechnologies

• Simple Object Access Protocol• BizTalk

Page 99: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

Summary

Use XML tools to clean existing documents Use a DTD editor Use an editor to create XSL and schemas Import database information for XML

conversion Use graphical editors to create XML

documents Convert XML to various outputs Define SOAP and BizTalk

Page 100: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XMLDocument Design

Introduction to XML Well-Formed XML Documents Creating a Valid XML Document XML Parsers The XML Family of Technologies

Page 101: Copyright © 2002 ProsoftTraining. All rights reserved. XML Document Design

XMLDocument Design

XSL Transformation XML Formatting XML Schemas Extensible Hypertext Markup Language

(XHTML) XML Tools