1. Trang chủ
  2. » Công Nghệ Thông Tin

xml english slide

36 492 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 36
Dung lượng 517 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

You must define your own tags  XML uses an XML Schema or a Document Type Definition DTD to describe the data yeah, but….. XML Components So Far One root element  One or more elemen

Trang 1

The Good, the Bad,

and the Ugly

Trang 2

XML Process Overview

Trang 3

XML

Trang 4

XML Process in Motion

 Showtime!!

Trang 5

XML: Overview

XML does NOT DO Anything!

 XML stands for EXtensible Markup Language

XML is a markup language much like HTML

XML was designed to describe data

XML tags are not predefined You must define your

own tags

XML uses an XML Schema or a Document Type

Definition (DTD) to describe the data (yeah, but…).

 XML with an XML Schema or a DTD is designed to be

self-descriptive (whatever that means…)

Trang 7

XML Overview: Root Element

One Root Element

Trang 8

XML Overview: Empty Elements

Empty, but not forgotten

<FACT>I made up these tags to suit my purpose.</FACT>

<FACT>My purpose was to help you read XML.</FACT>

<CONCLUSION>I made up these tags to help

you.</CONCLUSION>

</ARGUMENT>

</EXAMPLES_OF_LOGIC>

Trang 9

<FACT>Socrates was a man.</FACT>

<FACT>All men are created equal.</FACT>

<CONCLUSION>Socrates was Plato.</CONCLUSION> </ARGUMENT>

</EXAMPLES_OF_LOGIC>

Trang 10

XML Overview:

Declarations (Duuude, I'm XML!)

 Declare that a file contains XML and

conforms to version 1.0 (the current and only version, but hey!)

<?xml version="1.0"?>

(location: if used, line 1 always)

 Declare other attributes

<?xml version="1.0" encoding="utf-8"?>

<?xml version="1.0" encoding="iso-8859-1"?>

Trang 11

XML Components So Far

 One root element

 One or more elements (can be nested)

 Empty Elements optional

 Attributes optional

 XML declaration—optional

Trang 12

XML Overview: Namespaces

Where is Martha Stewart when you

need her?? (And what ARE these?)

 The result: naming conflicts

(are we having fun yet?)

 XML uses Namespaces to prevent

like-named elements from being confused

(and there is nothing worse than a

confused element, trust me…)

Trang 13

XML Namespace Example

<TRAINING_MODULE xmlns=“http://www.wordsite.com/NameSpace1”> <BUILDING_BLOCK>

<NAME>Element</NAME>

<DESCRIPTION>An element consists of a start tag, an end tag, and the data

that lies between the start and end tags For example, this sentence is part

of a DESCRIPTION element.</DESCRIPTION>

<FUNCTION>Stores data.</FUNCTION>

<NOTE>Elements can be nested inside other elements For example, this

NOTE element is nested inside a BUILDING_BLOCK element The preceding NAME element, DESCRIPTION element, and FUNCTION element are also nested inside the same BUILDING_BLOCK element.</NOTE>

</BUILDING_BLOCK>

……….

</TRAINING_MODULE>

XSLT

Trang 14

XML: Graduation

The (mostly) Whole Enchalada

 One root element

 One or more elements (can be nested)

 Empty Elements optional

 Attributes optional

 XML declaration—optional

Trang 15

XSLT

Trang 17

XSLT Overview:

eXtensible Stylesheet Language

 Purpose (porpoise, papoose):

Transform XML data to some type of output format – html files, PDF files, another xml file, etc for presentation.

 Specialized XML vocabulary

 Single Sourcing (oooh, wow…)

Multiple XSLT files can be applied to one

xml file to create multiple outputs.

 Separate Data from Presentation

Trang 18

<H2>Building Blocks of XML: A Teacher Guide</H2>

<H3>Instructions for teacher:</H3>

Trang 19

XSD:

eXtensible Stylesheet Definition

Trang 20

XSD Overview: Schema Pupose

 Purpose:

A schema is an XML file that describes the structure of an XML data file and the rules for what kind of data can be stored there

Trang 21

XSD Schema Example

 Take a look at your schema handout for an example of a

schema

 Go to www.w3schools.com and Microsoft for more

information about schema construction

Trang 22

XML Transformation:

Example

 View a real life XML transform

 See how the components fit together

Trang 23

XML Uses: The Good Stuff

 Web: Table of Contents, table oriented data

 Word and Excel import/export

 RoboHelp import/export

Trang 27

XML : The Bad

What They Never Tell You

Trang 28

XML: The BAD

How DOES XML Get Displayed?????

Things they don't tell you…

 No shoes, no shirt, no display

Requires XML-aware software and the extra stuff

necessary to display it

 Special encoding and character display

Trang 29

XML Display Gotchas

 Special characters like < > & and others

need special handling so that the xml

parser doesn’t get confused and think they are part of the XML data.

Trang 30

XML: The Ugly

My Data, YOUR Browser

Browsers use different ways of displaying XML (requires

browser detection)

 How the heck does XML actually GET displayed???

 Client display and Server display

 Validation and Error Interception

Trang 31

My Data, YOUR Browser

Browser Detection

 Option 1: Script Detection

//**** JavaScript Browser Variables ****

var isIE = (document.all) ? true : false;

var isDOM=

(document.getElementById && !document.all) ? true : false;

var isNetscape=(document.layers) ? true : false;

 Option 2 Put all XSLT and CSS references in the XML

file and sort of forget about Browser detection

Trang 32

My Data, YOUR Browser

Are You Being Served?

Server or Client Display

Trang 33

My Data, YOUR Browser

What Really, Really Happens

 Load the XML file into memory using the browser’s

method Look out for the bad guys

 Load the XSLT file into memory using the browser’s

method Same bad guy check

 Call the Transform process of the Browser you’re using

and write it out to the current page

Trang 34

XML A good option even so!

 Example 1: An XML TOC and data display

Trang 35

Sources and Links

(cf Building Documents with XML, XSL, and CSS)

 DOCBook: www.docbook.org and

www.docbook.sourceforge.net

 http://www.codehound.com/xml/

Trang 36

XML Tools and Editors

 Free, free, free

http://architag.com/xray/

Ngày đăng: 23/10/2014, 17:17

Xem thêm