Transcript
Page 1: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

1

XML

eXtensible

Markup

Language

Page 2: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

2

What is XML?XML היא שפה תיאורית XML לתיאור סטנדרטית נועדה לספק דרך

משמעות מידע ומבנה מידע כאשר הוא מועבר בין מערכות )כאשר אותן מערכות יכולות

להיות גם דפדפנים, והמידע עצמו יכול להיות מסמכים, טבלאות, תוצאות שאילתא וכו'(.

Page 3: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

3

HTML לבין XML ההבדל העיקרי בין

XML לא בא כדי להחליף את HTMLXML-ו HTMLפותחו למטרות שונות אחד מהשני XML על מה זה , ולהתמקדכדי להגדיר מידע פותח

.מידע

HTML איך , ולהתמקד על להציג מידע פותח כדי. שהמידע נראה

HTML מידע, להציג נועד XML מידעלהגדיר נועד

Page 4: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

4

XML הוא דינמי -אוסף התגים שעוזרים לך לעצב את מסמך הHTML ,שלך

.מוגדרים וקבועים מראשואת המבנה שלו, יכול להשתמש רק בתגים אלו HTMLמי שכותב מסמכי

ובתחביר של השפהXMLמאפשר הגדרת תגים דינמית בהתאם לצורך

Page 5: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

5

Who invented XML?

W3CWorld Wide Web Consortium

http://www.w3c.org/

Current version of XML:XML 1.0 Third Edition

Page 6: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

6

אלמנט פשוט

<MOVIENAME>BIG HIT</MOVIENAME>

  או

<MOVIENAME> </MOVIENAME>

 או

<MOVIENAME/>

תג התחלה תוכן תג סוף

Page 7: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

7

XMLדוגמא למסמך

. היא תמיד XML השורה הראשונה במסמך היא הגדרת ה-•צריכה להיות בראש המסמך

Root השורה הבאה הינה האלמנט הראשון בדף, ה-•Element

Child אלמנטים בנים )4 השורות הבאות מגדירות •Elements של אלמנט השורש )Root Element

Page 8: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

8

XML Syntax

<FirstName>Jack</FirstName><Character ID =“468767867”>

<LastName>Bauer</LastName></Character>

<?xml version="1.0"?><TwentyFour>

<Season val=“1”/>::</TwentyFour>

XML TagClosing TagContents / ValueSimple Element

Attribute

Complex ElementChild Elements

Empty Element Tag

Root ElementXML Declaration

Page 9: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

9

Data Hierarchy SummaryXML document is hierarchical in

its nature.

It can easily represent:

Organizational chart.Product trees.Directory tree.etc…

Page 10: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

10

Introduction

Database processing and document processing need each other Database processing needs document processing for

expressing database views Document processing needs database processing for storing

and manipulating data

As Internet usage increased, organizations wanted to make their Web pages more functional by displaying and updating data from organizational databases

Page 11: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

11

XML

XML, or Extensible Markup Language, developed in early 1990s

XML is a subset of SGML, or Standard Generalized Markup Language

Today XML is a hybrid of document processing and database processing

It provides a standardized yet customizable way to describe the content of documents

XML documents can automatically be generated from database data, and vice versa

SOAP is an XML-based standard protocol for sending messages of any type, using any protocol over the Internet

Page 12: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

12

XML )cont.(

XML is used for describing, representing, and materializing database views

XML is better than HTML because It provides a clear separation between document structure, content, and

materialization It is standardized but allows for extension by developers XML tags accurately represent the semantics of their data

Document Type Declarations (DTDs) and XML Schemas can be used to describe the content of XML documents

Both Oracle and SQL Server can produce XML documents from database data

Page 13: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

13

Example: XML Document

Page 14: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

14

XML DTD

XML document consists of two sections: Document Type Declaration )DTD(

The DTD begins with DOCTYPE <document_type_name> Document data

XML documents could be Type-valid if the document conforms to its DTD Well-formed and not be type-valid, because

It violates the structure of its DTD It has no DTD

DTD may be stored externally so many documents can be validated against the same DTD

Page 15: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

15

XSLT

XSLT, or the Extensible Style Language may be used to

materialize )transform( XML documents using XSL document From XML documents into HTML or into XML in another format

XSLT is a declarative transformation language Declarative: create rules, not procedure, to materialize the document

Transformational: transforms the input document into another document

XSLT uses stylesheets to indicate how to transform the elements of the XML document into another format

Page 16: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

16

Example: External DTD

Page 17: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

17

Example: XML Document

Page 18: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

18

Example: XML HTML

Page 19: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

19

Example: XML Browser

Page 20: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

20

XML Schema

XML Schema is a standard for describing the content of an XML document, i.e., defining custom vocabularies

Documents that conform to an XML Schema are called schema-valid An XML document can be well-formed and be neither type-valid nor schema-valid

Unlike DTDs, XML Schema documents are themselves XML documents that can be validated against their schema maintained by W3C

Page 21: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

21

Example: XML Schema

Page 22: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

22

Example: XML Schema

Page 23: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

23

Elements and Attributes Schemas consist of elements and attributes

Elements are used to carry data and attributes are used to carry metadata

Two types of elements: Simple elements have a single data value ComplexType elements can have one or more simple or

complexType elements ComplexType elements can have attributes

Page 24: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

24

Flat Schemas Flat schemas have all elements at the same level

Page 25: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

25

Structured Schemas

Structured schemas have defined subgroups

Page 26: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

26

Global Elements

To eliminate the definition duplication, elements can be declared globally, i.e., reside at the top level of the schema, and then reused

Page 27: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

27

Global Elements

Page 28: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

28

Example XML Industry Standards Accounting

Extensible Financial Reporting Markup Language )XFRML( Architecture and Construction

Architecture, Engineering, and Construction XML )aecXML( Automotive

Automotive Industry Action Group )AIAG( XML for the Automotive Industry )SAE J2008(

Banking Banking Industry Technology Secretariat )BITS( Bank Internet Payment System )BIPS(

Electronic Data Interchange Data Interchange Standards Association )DISA( XML/EDI Group

Page 29: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

29

Example XML Industry Standards )cont.(

Human Resources Human Resources Markup Language )hrml(

Insurance ACORD: Property and Casualty

Real Estate Real Estate Listing Management System )OpenMLS( Real Estate Transaction Standard )RETS(

Software IBM INRIA: Koala Bean Markup Language )KBML( Open Software Description Format )OSD(

Workflow Simple Workflow Access Protocol )SWAP( Workflow Management Coalition )MfMC(: Wf-XML

Page 30: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

30

XML Standards

XML: Extensible Markup Language XSL: XSLT Stylesheet. The document that provides the {match,

action} pairs and other data for XSLT to use when transforming an XML document

XSLT: A program that applies XSLT Stylesheets to an XML document to produce a transformed XML document

XML schema: An XML-compliant language for constraining the structure of an XML document

Page 31: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

31

Additional XML Standards Xpath

A sublanguage within XSLT used to identify parts of an XML document to be transformed

Can also be used for calculations and string manipulation

Xpointer A standard for linking one document to another

SAX: Simple API )application program interface( for XML An event-based parser that notifies a program when the elements of an

XML document have been encountered during document parsing

Page 32: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

32

Additional XML Standards )cont.( DOM: Document Object Model

An API that represents an XML document as a tree Each node of the tree represents a piece of the XML document A program can directly access and manipulate a node of the DOM representation

Xquery A standard for expressing database queries as XML documents The structure of the query uses XPath facilities, and the result of the query is

represented in an XML format XML Namespaces: A standard for allocating terminology to defined

collections X:Name is interpreted as the element Name as defined in namespace X Useful for disambiguating terms

Page 33: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

33

Processing XML

Systems need to read XML data and process it.

Parser module. Types of parsers:

SAX DOM

Page 34: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

34

The Parsers Role Allow the host application to read the data

stored in the XML elements. Validate the XML document. Construct an XML document or modify an

existing one.

Page 35: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

35

SAX Parser

Reads the XML in a sequential way element by element.

Uses an event mechanism to notify the host application about each new element found.

Low use of resources.

Page 36: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

36

SAX Events

Start Document End Document Start Element End Element Doc Characters XML Declaration

Page 37: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

37

DOM Parser

Reads the XML document and constructs a matching Objects Tree in memory.

Provides a rich API for accessing the document objects randomly.

The main object is DOM node.

Page 38: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

38

DOM Parser Cont.

Each element in the XML document is represented by a DOM node object.

The DOM node provides methods for retrieving the data it stores.

Page 39: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

39

DOM Node Methods

The DOM Node object provides the following methods:

getNodeName)( getNodeType)( getNodeValue)( getChildNodes)( etc…

Page 40: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

40

Parsers Comparison

 

SAX DOM

Speed Fast Slow

Resources Cheap Expensive

API Simple Rich

Page 41: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

41

XML Functions eDeveloper provides a set of functions to

read XML data. The functions use a DOM parser module

called XERCES.

Page 42: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

42

XML Functions Cont.

eDeveloper provides the following XML functions:

XMLGet)(XMLExists)(XMLFind)(XMLCnt)(

XMLDelete)(XMLInsert)(XMLModify)(XMLSetEncoding )(

Page 43: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

43

XML Schema

Another standard from W3C. Constraining XML document structure and

contents. The Schema itself is an XML document. Used by parsers for validation purposes.

Page 44: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

44

XML Schema Cont.

The XML Schema spec:http://www.w3.org/TR/xmlschema-0/

Page 45: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

45

XSL & XSLT

XSL: a style sheet for XML. XSLT: a transformation language for XML

documents. XSL FO: Formatting Objects for advanced

styling features.

Page 46: 1 XML eXtensible Markup Language. 2 What is XML? XML היא שפה תיאורית XML נועדה לספק דרך סטנדרטית לתיאור משמעות מידע ומבנה מידע

46

The future of XML

The next release is XML 1.1 W3C continue developing other XML

based standards: Name Spaces in XML 1.1 Xinclude and more…