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

  • Published on
    27-Dec-2015

  • View
    214

  • Download
    0

Embed Size (px)

Transcript

  • Slide 1
  • 1 XML eXtensible Markup Language
  • Slide 2
  • 2 What is XML? XML XML ( , , , ').
  • Slide 3
  • 3 XML HTML XML HTML XML -HTML XML , . HTML , . HTML , XML
  • Slide 4
  • 4 XML -HTML , , . HTML XML
  • Slide 5
  • 5 Who invented XML? W3C World Wide Web Consortium http://www.w3c.org/ Current version of XML: XML 1.0 Third Edition
  • Slide 6
  • 6 BIG HIT
  • Slide 7
  • 7 XML -XML. , -Root Element 4 (Child Elements) Root Element
  • Slide 8
  • 8 XML Syntax Jack Bauer : XML Tag Closing Tag Contents / Value Simple Element Attribute Complex Element Child Elements Empty Element Tag Root Element XML Declaration
  • Slide 9
  • 9 Data Hierarchy Summary XML document is hierarchical in its nature. It can easily represent: Organizational chart. Product trees. Directory tree. etc
  • Slide 10
  • 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
  • Slide 11
  • 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
  • Slide 12
  • 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
  • Slide 13
  • 13 Example: XML Document
  • Slide 14
  • 14 XML DTD XML document consists of two sections: Document Type Declaration (DTD) The DTD begins with DOCTYPE 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
  • Slide 15
  • 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
  • Slide 16
  • 16 Example: External DTD
  • Slide 17
  • 17 Example: XML Document
  • Slide 18
  • 18 Example: XML HTML
  • Slide 19
  • 19 Example: XML Browser
  • Slide 20
  • 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
  • Slide 21
  • 21 Example: XML Schema
  • Slide 22
  • 22 Example: XML Schema
  • Slide 23
  • 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
  • Slide 24
  • 24 Flat Schemas Flat schemas have all elements at the same level
  • Slide 25
  • 25 Structured Schemas Structured schemas have defined subgroups
  • Slide 26
  • 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
  • Slide 27
  • 27 Global Elements
  • Slide 28
  • 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
  • Slide 29
  • 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
  • Slide 30
  • 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
  • Slide 31
  • 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
  • Slide 32
  • 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
  • Slide 33
  • 33 Processing XML Systems need to read XML data and process it. Parser module. Types of parsers: SAX DOM
  • Slide 34
  • 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.
  • Slide 35
  • 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.
  • Slide 36
  • 36 SAX Events Start Document End Document Start Element End Element Doc Characters XML Declaration
  • Slide 37
  • 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.
  • Slide 38
  • 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.
  • Slide 39
  • 39 DOM Node Methods The DOM Node object provides the following methods: getNodeName() getNodeType() getNodeValue() getChildNodes() etc
  • Slide 40
  • 40 Parsers Comparison SAXDOM SpeedFastSlow ResourcesCheapExpensive APISimpleRich
  • Slide 41
  • 41 XML Functions eDeveloper provides a set of functions to read XML data. The functions use a DOM parser module called XERCES.
  • Slide 42
  • 42 XML Functions Cont. eDeveloper provides the following XML functions: XMLGet() XMLExists() XMLFind() XMLCnt() XMLDelete() XMLInsert() XMLModify() XMLSetEncoding ()
  • Slide 43
  • 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.
  • Slide 44
  • 44 XML Schema Cont. The XML Schema spec: http://www.w3.org/TR/xmlschema-0/
  • Slide 45
  • 45 XSL & XSLT XSL: a style sheet for XML. XSLT: a transformation language for XML documents. XSL FO: Formatting Objects for advanced styling features.
  • Slide 46
  • 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