XML What is XML? XML v.s. HTML XML Components Well-formed and Valid Document Type Definition (DTD) Extensible Style Language (XSL) SAX and DOM.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

XML I.
What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
An Introduction to XML Based on the W3C XML Recommendations.
XML 6.3 DTD 6. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:  Elements.
History Leading to XHTML
Introduction to XML: DTD
Document Type Definitions
CSCI 7818 (Topics in Software Engineering) Web Infrastructure, Services, and Applications Document Type Definition (DTD) Author: Lukasz Kurgan.
A Technical Introduction to XML Transparency No. 1 XML quick References.
Chapter 10 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 10 Sebesta: Programming the World Wide Web.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)
COS 381 Day 14. Agenda Questions?? Resources Source Code Available for examples in Text Book in Blackboard
COS 381 Day 16. Agenda Assignment 4 posted Due April 1 There was no resubmits of Assignment Capstone Progress report Due March 24 Today we will discuss.
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
Introduction to XML This material is based heavily on the tutorial by the same name at
Chapter 13 XML Concept of XML Simple Example of XML XML vs. HTML in Syntax XML Structure DTD and CDATA Sections Concept of SAX Processing Download and.
ECA 228 Internet/Intranet Design I Intro to XML. ECA 228 Internet/Intranet Design I HTML markup language very loose standards browsers adjust for non-standard.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
XML eXtensible Markup Language by Darrell Payne. Experience Logicon / Sterling Federal C, C++, JavaScript/Jscript, Shell Script, Perl XML Training XML.
CREATED BY ChanoknanChinnanon PanissaraUsanachote
XML: Overview MIS 181.9: Service Oriented Architecture 2 nd Semester,
XML CPSC 315 – Programming Studio Fall 2008 Project 3, Lecture 1.
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
XML - Why: The HTML-Dilemma HTML, SGML, XML - How: Syntax, Concept, Language Elements Basics Well-formed XML-Documents (without DTD) Valid XML-Documents.
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
Intro. to XML & XML DB Bun Yue Professor, CS/CIS UHCL.
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
1 Tutorial 13 Validating Documents with DTDs Working with Document Type Definitions.
Lecture 6 XML DTD Content of.xml fileContent of.dtd file.
XML A web enabled data description language 4/22/2001 By Mark Lawson & Edward Ryan L’Herault.
1 Chapter 10: XML What is XML What is XML Basic Components of XML Basic Components of XML XPath XPath XQuery XQuery.
Softsmith Infotech XML. Softsmith Infotech XML EXtensible Markup Language XML is a markup language much like HTML Designed to carry data, not to display.
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
XML Instructor: Charles Moen CSCI/CINF XML  Extensible Markup Language  A set of rules that allow you to create your own markup language  Designed.
Lecture 16 Introduction to XML Boriana Koleva Room: C54
School of Computing and Information Systems CS 371 Web Application Programming XML and JSON Encoding Data.
1 Introduction to XML XML stands for Extensible Markup Language. Because it is extensible, XML has been used to create a wide variety of different markup.
ISO/TC 211 WG4 WI 18 Encoding Foil no. 1 Annex C XML and XMI David Skogan SINTEF Telecom and Informatics
An Introduction to XML Sandeep Bhattaram
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
INFSY 547: WEB-Based Technologies Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
What is XML? eXtensible Markup Language eXtensible Markup Language A subset of SGML (Standard Generalized Markup Language) A subset of SGML (Standard Generalized.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
Tutorial 9 Working with XHTML. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Describe the history and theory of XHTML.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
CIS 228 The Internet 9/20/11 XHTML 1.0. “Quirks” Mode Today, all browsers support standards Compliant pages are displayed similarly There are multiple.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
XML Introduction to XML Extensible Markup Language.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Extensible Markup Language (XML) Pat Morin COMP 2405.
XML BASICS and more…. What is XML? In common:  XML is a standard, simple, self-describing way of encoding both text and data so that content can be processed.
Unit 4 Representing Web Data: XML
CIS 228 The Internet 9/20/11 XHTML 1.0.
Chapter 7 Representing Web Data: XML
Chapter X IXXXXXXXXXXXXXXXX.
Allyson Falkner Spokane County ISD
Presentation transcript:

XML What is XML? XML v.s. HTML XML Components Well-formed and Valid Document Type Definition (DTD) Extensible Style Language (XSL) SAX and DOM

What is XML ?  Extensible Markup Language(XML) is a meta-language that describes the content of the document(self-describing data)  Derives from SGML. Interoperable with both HTML and SGML.

XML v.s. HTML  Markup languages generally combine two distinct functions of representing text (document) –the ‘look’ and the ‘structure’.  HTML and XML have different sets of goals. While HTML was designed to display data and hence focused on the ‘look’ of the data, XML was designed to describe and carry data and hence focuses on ‘what data is’.

XML v.s. HTML  HTML is about displaying data and XML is about describing data.  HTML and XML are complementary to each other.  HTML explicitly defines a set of legal tags. …. XML allows any tags to be used,you can create new tags. ….

XML Components Prolog Defines the xml version,entity definitions, and DOCTYPE Components of the document Tags and attributes CDATA(character data) Entities Processing instructions Comments

XML Prolog XML Files always start with a prolog The version of xml is required The encoding identified character set(default UTF-8) The value standalone identifies if an external document is referenced for DTD of entity definition The prolog can contain entities and DTD definitions

Prolog Example <DOCTYPE authors[ ]> James Gosling …

XML DOCTYPE Document Type Declarations  Specifies the location of the DTD defining the syntax and structure of elements in the document  Common forms:  The root identifies the starting element( root element) of the document  The DTD can be external to the XML document, referenced by a SYSTEM or PUBLIC URL PUBLIC URL refers to a DTD intended for public use SYSTEM UPL refers to a private DTD (located on the local file system or HTTP server)

DOCTYPE Examples Book must be the root element DTD located in same directory of xml document <!DOCTYPE book SYSTEM “ DTD located HTTP server: vishnu.cs.lamar.edu

XML DOCTYPE Specifying a PUBLIC DTD The Formal Public Identifier(FPI) has four parts: 1.Connection of DTD to a formal standard - if defining yourself + nonstandards body has approved the DTD ISO if approved by formal standards committee 2.Group responsible for the DTD 3.Description and type of document 4.Language used in the DTD

PUBLIC DOCTYPE Example <!DICTYPE Book PUBLIC “-//w3c//DTD XHMTL 1.0 Transitional //EN” “ transitional.dtd”> <!DICTYPE CWP PUBLIC “-//Prenticd Hall//DTD Core Series 1.0 //EN” “

XML Root Element Required for XML –aware applications to recognize beginning and end of document, it is the first element. All other elements must be nested within this root element. Example: 123 …

XML Tags Tag names: Case sensitive Start with a letter or underscore After first charcater, numbers, - and. are allowed Connot contain whitespaces Avoid use of colon expect for indicating namespaces Tags can have attributes what did you do ? All XML elements must have close tags.

Document CDATA CDATA(character data) is not parsed

Document Entities Entities refer to a data item,typically text General entity references start with & and end with ; The entity reference is replaced by it’s true value when parsed The characters & ‘ “ require entity references to avoid conflicts with the XML application < > & " &apos; Entities are user definable <!DOCTYPE book[ ]> web programming, &copyright;

Processing Instructions Application-specific instruction to the XML processor Example Marty Hall

XML Comments Comments are the same as HTML comments

Well-formed versus Valid An XML document can be well-formed if it follows basic syntax rules. An XML document is valid if its structure matches a Document Type Definition (DTD) and it is well-formed.

Document Type Definition(DTD) Defines Structure of the Document Allowable tags and their attributes Attribute values constraints Nesting of tags Number of occurrences for tags Entity definitions

DTD Example

Defining Elements Types ANY Any well-formed xml data EMPTY Element cannot contain any text or child elements PCDATA Character data only (should not contain markup) Elements List of legal child elements (no character data) Mixed May contain character data and/or child elements (cannot constrain order and number of child elements)

Defining Elements Cardinality [none] Default(one and only one instance) ? 0,1 * 0,1,…, n + 1,2,…, n List Operators, Sequence( in order) | Choice(one of several)

Defining Attribute Example <!ATTLIST Product cost CDATA #FIXED “200” id CDATA #REQUIRED>

Attribute Type  CDATA Essentially anything;simply unparsed data  Enumeration Attribute(value1|value2|value3)[Modifier]  Eight other attribute types ID,IDREF,NMTOKEN,NMTOKENS,ENTIRY,ENTITIES,NOTATION

Attribute Modifiers #IMPLIED Attribute is not required #REQUIRED Attribute must be present #FIXED “value” Attribute is present and always has this value Default value (applies to enumeration)

Defining Entities Specify entity reference resolution in a DTD using the ENTITY keyword.

Limitations of DTDs  DTD itself is not in XML format – more work for parsers  Does not express data types (weak data typing)  No namespace support  Document can override external DTD definitions  No DOM support  XML Schema is intended to resolve these issues but … DTDs are going to be around for a while

Namespace  Namespaces identify collections of element type declarations so that they do not conflict with other element type declarations with the same name created by other programmers  Two predefined XML namespaces are xml and xsl.  You can create your own namespaces Example: English Thrombosis can be differentiated by using namespaces, as in English Thrombosis

XSL - Extensible Style Language Defines the layout of an xml document, an XSL style sheet provides the rules for displaying an XML document. XSLT is XSL transformations. XML -> XSLT -> HTML In XML document include:

XSL Example HTML....

What is the SAX? SAX is the Simple API for XML, originally a Java- only API. SAX was the first widely adopted API for XML in Java, and is a “de facto” standard. SAX is an event-based API. The application implements handlers to deal with the different events, much like handling events in a graphical user interface.

What is the Document Object Model (DOM)? Is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents. Provides APIs that let you create nodes, modify them, delete and rearrange them. So it is relatively easy to create a DOM. Maintains a recommended tree-based API for XML and HTML documents.

DOM/SAX Processing DOM is a standard. It yields a tree in memory. SAX yields a sequence of events corresponding to XML input. Both generally destroy attribute ordering, insignificant white space, insignificant namespace aspects, … Verification of a signature based on DOM/SAX requires serialization to a byte stream of the DOM tree or the SAX event stream.

Summary  XML is a self-describing meta data  DOCTYPE defines the root element and location of DTD  Document Type Definition(DTD) defines the grammar of the document Required to validate the document Constrains grouping and cardinality of elements  XSL is defined as a language for expressing stylesheets Is a language for transforming XML documents Is an XML vocabulary for specifying the formatting of XML documents  DOM and SAX are two most common low-level APIs, they are all in some form of standardization (SAX as a de facto, DOM by the W3C )

XML Resources XML 1.0 Specification WWW consortium’s Home Page on XML Sun Page on XML and Java Apache XML Project XML Resource Collection O’Reilly XML Resource Center

Applications of XML Configuration files Used extensively in J2EE architecture Media for data interchange A better alternative to proprietary dara form B2B transactions on the Web Electronic business orders (ebXML) Financial Exchange (IFX) Messaging exchange (SOAP)