Click here to load reader

Extensible Markup Language (XML)

  • Upload
    kynton

  • View
    60

  • Download
    0

Embed Size (px)

DESCRIPTION

Extensible Markup Language (XML). What is a Markup Language. A syntax and procedure for embedding in text documents tags that control formatting when the documents are viewed by a special application. Hi - PowerPoint PPT Presentation

Citation preview

Extensible Markup Language (XML)

Extensible Markup Language(XML)1What is a Markup LanguageA syntax and procedure for embedding in text documents tags that control formatting when the documents are viewed by a special application. Hi a set of codes or tags that surrounds content and tells a person or program what that content is (its structure) and/or what it should look like (its format). Markup tags have a distinct syntax that sets them apart from the content that they surround.22History of Markup Languages31967: GenCode

1970s, 1980s :Tex

1980s: ScribeEarly 80s: SGML

1991: HTMLLate 90s: XML`4Motivation For XML.5XML is an attempt to package up the important virtues and most-used features of SGML in a compact, easily-implemented package that is optimized for delivery on the WWW. (Bray)XML is started as a simplified subset of the Standard Generalized Markup Language (SGML), and is designed to be relatively human-legible. By adding semantic constraints, application languages can be implemented in XML.Data Storage in an organized way.

Fast and easy exchange of Data.

XML Syntax6HeaderComments:-Nesting:- Empty elements:- One root element!Some Standards that use XML7SVGMathMLHL7 V. 3.0 and Medical Markup Language (MML)XML Example8

Won Kim Modern Database Systems: The Object Model, Interoperability, and Beyond. Modern Database Systems ACM Press and Addison-Wesley 1995 0-201-59098-0 db/books/collections/kim95.html

Serge Abiteboul Richard Hull Victor Vianu Foundations of Databases. Addison-Wesley 1995 0-201-53771-0 db/books/dbtext/abiteboul95.html

Defining an XML Language9 i.e. which in which orderNot strictly necessaryyou can parse/produce XML without formally defining the structure of the languageThis is called a Well-formed documentDTDs (Document Type Definitions)Simple, limitedThis is called a valid documentXML-Schema(too?) complex and expressive (includes inheritance, restricted datatypes, ranges) Data binding Define (e.g.) java classes + mapping from object tree to XML Document JAXB, Castor, JSX, NeuroMLDTD10 ..

Databases Overview11DataRelational DataXMLSecondaryStorageMain MemoryTools as - SAX- DOM- LINQDBMS as- SednaRDBMS as- MySQL MS SQL Server Oracle DB2

Tools to read/write an XML file12SAXDOMLINQWhy we need such tools???

To make sure that the file is either valid or well-formed. To read document in term of entities or attributes. SAX (Simple API for XML)13Event based. you provide a startElement(), characters() endElement() methods. You have to keep track of where you arein the tree/document.Fast, but a bit painful to code.Mainly adopted in Java.DOM (Document Object Model)14You get a tree of objects of type Element and Attribute + methods to navigate the tree. Contents are all strings, so you have to do data conversion yourself to set ints, floats, your Object types.Mainly adopted in MS .NET.LINQ (Language Integrated Query)15Microsoft Property and innovation.Introduced in Nov 2007 as a library in .NET Framework 3.5.Very fast and efficient library to query Relational Databases, XML Files or even arrays.We write SQL like Query to get the information.

How to Query These Data???16

Querying Data 17DataRelational DataXMLSecondaryStorageMain MemoryStandard Query Language (SQL)XQueryTranslatorXQUERY18An XML Query Language

W3C Recommendation since 23 January 2007

e.g: /dblp/book[author=John Smith]

Return of Query is XML ElementsQuery Data (Once Again)19DataRelational DataXMLSecondaryStorageMain MemoryStandard Query Language (SQL)XQueryTranslatorTranslatorRelated Technologies20XPath

XSLT

XPATH21XPath: a way to refer to specific subset of elements / atributes in a documentMethod to navigate in file not to query."/dblp" -- the root element"/dblp/book[1]" -- first book element"//book" -- all elements"//@title" -- all title= attributes

... used in XSLT for pattern matchingHow to Display These Data in user friendly way ???22

XSLT (Extensible Stylesheet Language Transformations)23

Currently Incollection Title Book Title Author Pages Year

XSLT (continued)24Add this line to original file

Questions25