1/14 ITApplications XML Module Session 2: Using and Creating XML Documents.

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

Defining XML The Document Type Definition. Document Type Definition text syntax for defining –elements of XML –attributes (and possibly default values)
1/19 ITApplications XML Module Session 4: Document Type Definition (DTD) Part 2.
XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
XSLT (eXtensible Stylesheet Language Transformation) 1.
An Introduction to XML Based on the W3C XML Recommendations.
© De Montfort University, XML – a meta language Howell Istance and Peter Norris School of Computing De Montfort University.
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.
Extensible Markup Language Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
Introduction to XML John Arnett, MSc Standards Modeller Information and Statistics Division NHSScotland Tel: (x2073)
XML Schemas Microsoft XML Schemas W3C XML Schemas.
17-Jun-15 XHTML 2 What is XHTML? XHTML stands for Extensible Hypertext Markup Language XHTML is aimed to replace HTML.
XML: New or Old? XML was not an extention of HTML That already existed! SGML (ISO 8879) XML was a simplification of SGML  80 / 20 rule  (80% of the features.
4/16/2007Declare a Schema File I1. 4/16/2007Declare a Schema File I2 Declare a Schema File A collection of semantic validation rules designed to constrain.
XML Introduction What is XML –XML is the eXtensible Markup Language –Became a W3C Recommendation in 1998 –Tag-based syntax, like HTML –You get to make.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
COS 381 Day 14. Agenda Questions?? Resources Source Code Available for examples in Text Book in Blackboard
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
Jennifer Widom XML Data DTDs, IDs & IDREFs. Jennifer Widom DTDs, IDs & IDREFs “Well-Formed” XML Adheres to basic structural requirements Single root element.
Copyright © 2003 Pearson Education, Inc. Slide 2-1 Created by Cheryl M. Hughes, Harvard University Extension School — Cambridge, MA The Web Wizard’s Guide.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
Why XML ? Problems with HTML HTML design - HTML is intended for presentation of information as Web pages. - HTML contains a fixed set of markup tags. This.
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
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.
Introduction to XML Eugenia Fernandez IUPUI. What is XML? From the World Wide Web Consortium (W3C) The Extensible Markup Language (XML) is the universal.
XML – 1h. XML: Contents What is XML? What is “Well Formed” XML? What is “Valid” XML? –Document Type Definitions –Scalable Vector Graphics (SVG) XML in.
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 Extensible Markup Language. What is XML? ● meta-markup language ● a language for defining a family of languages ● semantic/structured mark-up language.
XML Syntax - Writing XML and Designing DTD's
XML Extensible Markup Language. What is XML? An infrastructure for describing text and data Developed by W3C(the World Wide Web Consortium)
XP 1 DECLARING A DTD A DTD can be used to: –Ensure all required elements are present in the document –Prevent undefined elements from being used –Enforce.
WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.
These Questions are copied from
FIGIS’ML Hands-on training - © FAO/FIGIS An introduction to XML Objectives : –what is XML? –XML and HTML –XML documents structure well-formedness.
 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,
Session IV Chapter 9 – XML Schemas
1 Tutorial 13 Validating Documents with DTDs Working with Document Type Definitions.
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
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.
E0262 – MIS – Multimedia Storage Techniques XML (Extensible Markup Language  XML is a markup language for creating documents containing structured information.
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.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
17 Apr 2002 XML Syntax: Documents Andy Clark. Basic Document Structure Element tags – Elements have associated attributes Text content Miscellaneous –
Lecture 16 Introduction to XML Boriana Koleva Room: C54
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.
1 Credits Prepared by: Rajendra P. Srivastava Ernst & Young Professor University of Kansas Sponsored by: Ernst & Young, LLP (August 2005) XBRL Module Part.
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.
The eXtensible Markup Language (XML). Presentation Outline Part 1: The basics of creating an XML document Part 2: Developing constraints for a well formed.
What it is and how it works
Tutorial 13 Validating Documents with Schemas
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
Well Formed XML The basics. A Simple XML Document Smith Alice.
Information Design Trends Unit 4: Sources and Standards Lecture 3: A Brief Introduction to XML.
What is XML? eXtensible Markup Language eXtensible Markup Language A subset of SGML (Standard Generalized Markup Language) A subset of SGML (Standard Generalized.
ASHIMA KALRA  INTRODUCTION OF XML INTRODUCTION OF XML  XML FEATURES XML FEATURES  XML SYNTAX XML SYNTAX  XML ELEMENTS XML ELEMENTS  XML ATTRIBUTES.
XML blocks XML STRUCTURE The most basic building blocks of an XML file are elements, attributes and comments. Compiled based on Tutorial PhUSE 2008 XML.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XP 1Creating Web Pages with XML Tutorial 1 New Perspectives on XML Tutorial 1 – Creating an XML Document.
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.
XML intro. 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.
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.
Allyson Falkner Spokane County ISD
Presentation transcript:

1/14 ITApplications XML Module Session 2: Using and Creating XML Documents

2/14 Using and Creating XML Documents XML is comprised of elements, attributes and values. XML is comprised of elements, attributes and values. An XML document should start with a processing instruction that indicates the version of XML that is used. An XML document should start with a processing instruction that indicates the version of XML that is used. Example: Example:

3/14 Every XML document has a “root element” that contains every element in the document. Every XML document has a “root element” that contains every element in the document. Each element must have a matching closing tag Each element must have a matching closing tag Elements can contain elements or character data Elements can contain elements or character data Example: Example: <money><currency><code>USD</code><exchangerate> </exchangerate> US Dollars US Dollars </currency><currency><code>EUR</code><exchangerate> </exchangerate><description>Euro</description></currency></money> Filename: Currency.xml Filename: Currency.xml

4/14 XML tags are case sensitive, always use lower case to describe your elements. XML tags are case sensitive, always use lower case to describe your elements. Comments may be expressed in XML and the syntax is similar to HTML comments. Comments may be expressed in XML and the syntax is similar to HTML comments.Example: <software> Microsoft Windows XP Microsoft Windows XP Microsoft Office 2003 Microsoft Office 2003 Altova XMLSpy 2006 Altova XMLSpy 2006 </software> Filename: SoftwareVersion.xml

5/14 Elements can have attributes Elements can have attributes Attributes are added to the start tag of an element Attributes are added to the start tag of an element Attributes must have a value Attributes must have a value Cannot have duplicate attribute names on an element Cannot have duplicate attribute names on an element Attributes can contain significant data, be reference markers or “describe” the data in the element (meta-data) Attributes can contain significant data, be reference markers or “describe” the data in the element (meta-data)

6/14 Example: Example: <exchangerate>1.2500</exchangerate></month> <exchangerate>1.2500</exchangerate></month> <exchangerate>1.2600</exchangerate></month></index></currencyforecast> Filename: CurrencyForecast.xml

7/14 XML Documents must be well-formed XML Documents must be well-formed Matching start and end tags for elements Matching start and end tags for elements Elements must not overlap Elements must not overlap Example of an invalid XML document: Example of an invalid XML document: </example> One root element One root element Example of an invalid XML document: Example of an invalid XML document: <incorrect></incorrect> <incorrect></incorrect>

8/14 Attribute values must be quoted Attribute values must be quoted <stafflist> <firstname>Eran</firstname><surname>Stern</surname></name></stafflist> Filename: AttributeExample.xml

9/14 Element may not have two attributes with the same name. Element may not have two attributes with the same name. Example of an invalid xml document: <stafflist> <firstname>Eran</firstname><surname>Stern</surname></name></stafflist> Filename: InvaildXMLExample.xml Filename: InvaildXMLExample.xml

10/14 Comments must not appear inside tags Comments must not appear inside tags “<“ and “&” cannot appear “unescaped”. “<“ and “&” cannot appear “unescaped”. Escape characters: Escape characters: & & & & &apos; ' &apos; ' > > > > < < < < " " " "

11/14 Make use of Elements or Attributes? Elements can describe structure as attributes can not. Elements can describe structure as attributes can not. It is not possible for attributes to contain multiple values. Elements can contain child elements which can contain multiple values. It is not possible for attributes to contain multiple values. Elements can contain child elements which can contain multiple values. Elements can be extended as attributes may not. Elements can be extended as attributes may not. In general, it easier to manipulate XML elements rather than attributes in most programming languages. In general, it easier to manipulate XML elements rather than attributes in most programming languages.

12/14 Validating XML documents An XML document with correct syntax is called a XML document. An XML document with correct syntax is called a WELL FORMED XML document. XML documents may be validated against Document Type Definitions (DTD) or XML Schemas. DTDs will be covered in more details in the next two sessions. XML documents may be validated against Document Type Definitions (DTD) or XML Schemas. DTDs will be covered in more details in the next two sessions.

13/14 There are various XML validators: There are various XML validators: W3Schools on-line XML validator W3Schools on-line XML validator Browsers such as Microsoft Explorer have a built-in XML parser. Browsers such as Microsoft Explorer have a built-in XML parser. Altova's XMLSPY. This software can be installed on your machine and can assist you in creating and validating XML files. You can download a trial copy from the following link: Altova's XMLSPY. This software can be installed on your machine and can assist you in creating and validating XML files. You can download a trial copy from the following link: Equivalent tools that run on Mac OS X and Linux: Equivalent tools that run on Mac OS X and Linux:

14/14 References Useful links: Useful links: penguin.dcs.bbk.ac.uk/academic/xml/more-xml/index.php penguin.dcs.bbk.ac.uk/academic/xml/more-xml/index.php penguin.dcs.bbk.ac.uk/academic/xml/more-xml/index.php webdesign.about.com/library/nosearch/bl_xmlclass1-2.htm webdesign.about.com/library/nosearch/bl_xmlclass1-2.htm webdesign.about.com/library/nosearch/bl_xmlclass1-2.htm