1 xml extensible markup language. 2 what is xml? xml היא שפה תיאורית xml נועדה...

Post on 27-Dec-2015

234 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

XML

eXtensible

Markup

Language

2

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

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

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

3

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

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

.מידע

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

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

4

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

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

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

5

Who invented XML?

W3CWorld Wide Web Consortium

http://www.w3c.org/

Current version of XML:XML 1.0 Third Edition

6

אלמנט פשוט

<MOVIENAME>BIG HIT</MOVIENAME>

  או

<MOVIENAME> </MOVIENAME>

 או

<MOVIENAME/>

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

7

XMLדוגמא למסמך

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

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

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

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

9

Data Hierarchy SummaryXML document is hierarchical in

its nature.

It can easily represent:

Organizational chart.Product trees.Directory tree.etc…

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

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

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

13

Example: XML Document

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

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

16

Example: External DTD

17

Example: XML Document

18

Example: XML HTML

19

Example: XML Browser

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

21

Example: XML Schema

22

Example: XML Schema

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

24

Flat Schemas Flat schemas have all elements at the same level

25

Structured Schemas

Structured schemas have defined subgroups

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

27

Global Elements

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

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

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

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

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

33

Processing XML

Systems need to read XML data and process it.

Parser module. Types of parsers:

SAX DOM

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.

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.

36

SAX Events

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

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.

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.

39

DOM Node Methods

The DOM Node object provides the following methods:

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

40

Parsers Comparison

 

SAX DOM

Speed Fast Slow

Resources Cheap Expensive

API Simple Rich

41

XML Functions eDeveloper provides a set of functions to

read XML data. The functions use a DOM parser module

called XERCES.

42

XML Functions Cont.

eDeveloper provides the following XML functions:

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

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

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.

44

XML Schema Cont.

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

45

XSL & XSLT

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

documents. XSL FO: Formatting Objects for advanced

styling features.

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…

top related