XML. 2 Microsoft The Extensible Markup Language (XML) is a general-purpose markup language. markup language It is classified as an extensible language.

Slides:



Advertisements
Similar presentations
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.
Advertisements

3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
IS 373—Web Standards Todd Will
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
DT228/3 Web Development Introduction to XML.
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.
DECO 3002 Advanced Technology Integrated Design Computing Studio Tutorial 5 – XML Basic School of Architecture, Design Science and Planning Faculty of.
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
Introduction to XML: Yong Choi CSU Bakersfield.
Introduction to XML Rashmi Kukanur. XML XML stands for Extensible Markup Language XML was designed to carry data XML and HTML designed with different.
Introduction to XML This material is based heavily on the tutorial by the same name at
Introducing HTML & XHTML:. Goals  Understand hyperlinking  Understand how tags are formed and used.  Understand HTML as a markup language  Understand.
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.
Pemrograman Berbasis WEB XML part 2 -Aurelio Rahmadian- Sumber: w3cschools.com.
XML introduction to Ahmed I. Deeb Dr. Anwar Mousa  presenter  instructor University Of Palestine-2009.
 Introduction to XML Introduction to XML  Features of XML Features of XML  Syntax of XML Syntax of XML  Syntax rules of XML document Syntax rules.
What is XML? XML stands for EXtensible Markup Language
Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.
WPF chapter 15 Dr. John Abraham Professor UTPA. WPF –an introduction WPF provides a single platform capable of handling graphics, audio and video. WPF.
CREATED BY ChanoknanChinnanon PanissaraUsanachote
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Pemrograman Berbasis WEB XML -Aurelio Rahmadian- Sumber: w3cschools.com.
Document Type Definitions Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Address: Course Page:
Introduction to XML. What is XML? Extensible Markup Language XML Easier-to-use subset of SGML (Standard Generalized Markup Language) XML is a.
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.
XHTML. Introduction to XHTML What Is XHTML? – XHTML stands for EXtensible HyperText Markup Language – XHTML is almost identical to HTML 4.01 – XHTML is.
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,
Session IV Chapter 9 – XML Schemas
Tutorial 1: XML Creating an XML Document. 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content.
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
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.
How do I use HTML and XML to present information?.
1 Chapter 10: XML What is XML What is XML Basic Components of XML Basic Components of XML XPath XPath XQuery XQuery.
XML eXtensible Markup Language. Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB.
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
CIS 275—Web App Dev I XML. 2 Introduction to XMLXML XML stands for ________________________. HTML was designed to display data. XML was designed to _________.
Windows Presentation Foundation (WPF) Chapter 16 Dr. Abraham.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.
WEB APPLICATION DEVELOPMENT For More visit:
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
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.
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
XML Introduction. Markup Language A markup language must specify What markup is allowed What markup is required How markup is to be distinguished from.
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.
XSD: XML Schema Language Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
ASHIMA KALRA  INTRODUCTION OF XML INTRODUCTION OF XML  XML FEATURES XML FEATURES  XML SYNTAX XML SYNTAX  XML ELEMENTS XML ELEMENTS  XML ATTRIBUTES.
Introduction to DTD A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
XML DTD. XML Validation XML with correct syntax is "Well Formed" XML. XML validated against a DTD is "Valid" XML.
XML. HTML Before you continue you should have a basic understanding of the following: HTML HTML was designed to display data and to focus on how data.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
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 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.
What is XML?.
Presentation transcript:

XML

2 Microsoft The Extensible Markup Language (XML) is a general-purpose markup language. markup language It is classified as an extensible language because it allows its users to define their own tags.extensible languagetags XML is a markup language for documents containing structured information. Its primary purpose is to facilitate the sharing of structured data across different information systems, particularly via the Internet. Internet XML is recommended by the World Wide Web Consortium. It is a fee-free open standard.recommendedWorld Wide Web Consortiumopen standard What is XML?

3 Microsoft So XML is Just Like HTML? No. In HTML, both the tag semantics and the tag set are fixed. An is always a first level heading and the tag is meaningless. XML specifies neither semantics nor a tag set.

4 Microsoft Why Is XML Important? Plain Text –Since XML is not a binary format, you can create and edit files with anything from a standard text editor to a visual development environment. –That makes it easy to debug your programs, and makes it useful for storing small amounts of data. –XML provides scalability for anything from small configuration files to a company-wide data repository. Data Identification –XML tells you what kind of data you have, not how to display it.

5 Microsoft Why Is XML Important? XML can Separate Data from HTML –With XML, your data is stored outside your HTML. XML is Used to Exchange Data –With XML, data can be exchanged between incompatible systems. XML and B2B –With XML, financial information can be exchanged over the Internet.

6 Microsoft Why Is XML Important? XML Can be Used to Share Data –With XML, plain text files can be used to share data. –Since XML data is stored in plain text format, XML provides a software- and hardware-independent way of sharing data. –In the real world, computer systems and databases contain data in incompatible formats. One of the most time-consuming challenges for developers has been to exchange data between such systems over the Internet. –Converting the data to XML can greatly reduce this complexity and create data that can be read by many different types of applications.

7 Microsoft Why Is XML Important? XML Can Be Used to Create Specialized Vocabularies –XML is an extensible standard. –By using XML as a base, you can create your own vocabularies. Wireless Application Protocol (WAP), Wireless Markup Language (WML), and Simple Object Access Protocol (SOAP) are some examples of specialized XML vocabularies.

8 Microsoft Other Applications of XML Molecular sciences with CML –Peter Murray-Rust’s Chemical Markup Language (CML) Science and math with MathML –The Mathematical Markup Language (MathML) is an XML application for mathematical equations. Webcasting with CDF –Microsoft’s Channel Definition Format (CDF) is an XML application for defining channels. Web sites use channels to upload information to readers who subscribe to the site rather than waiting for them to come and get it. This is alternately called Webcasting or push.

9 Microsoft Other Applications of XML Software updates through OSD –The Open Software Description (OSD) format is an XML application co-developed by Marimba and Microsoft for updating software automatically. OSD defines XML tags that describe software components. The description of a component includes the version of the component, its underlying structure, and its relationships to and dependencies on other components Vector graphics with both PGML and VML –Vector graphics better than GIF, JPEG images –The Precision Graphics Markup Language (PGML) from IBM, Adobe, Netscape, and Sun. –The Vector Markup Language (VML) from Microsoft, Macromedia, Autodesk, Hewlett-Packard, and Visio

10 Microsoft Other Applications of XML Financial data with OFX –the Open Financial Exchange Format (OFX) is an XML application used to describe financial data of the type you’re likely to store in a personal finance product like Money or Quicken. Any program that understands OFX can read OFX data. And since OFX is fully documented and non- roprietary (unlike the binary formats of Money, Quicken, and other programs) it’s easy for programmers to write the code to understand OFX.

11 Microsoft Other Applications of XML Financial data with OFX

12 Microsoft Other Applications of XML Financial data with OFX

13 Microsoft Other Applications of XML Automated voice responses with VoxML Financial data with OFX Legally binding forms with XFDL Human resources job information with HRML Meta-data through RDF Internal use of XML by various companies, including Microsoft, Federal Express, and Netscape

14 Microsoft XML Syntax The syntax rules of XML are very simple and very strict. An Example XML Document XML documents use a self-describing and simple syntax. Students Faculty Reminder Learn XML

15 Microsoft XML Syntax defines the XML version and the character encoding used in the document. In this case the document conforms to the 1.0 specification of XML and uses the ISO (Latin-1/West European) character set. The next line describes the root element of the document

16 Microsoft XML Syntax The next 4 lines describe 4 child elements of the root (to, from, heading, and body) Students Faculty Reminder Learn XML last line defines the end of the root element

17 Microsoft XML Syntax All XML Elements Must Have a Closing Tag With XML, it is illegal to omit the closing tag. In HTML some elements do not have to have a closing tag. The following code is legal in HTML: This is a paragraph This is another paragraph XML all elements must have a closing tag, like this: This is a paragraph This is another paragraph

18 Microsoft XML Syntax XML Tags are Case Sensitive This is incorrect This is correct

19 Microsoft XML Syntax XML Elements Must be Properly Nested Improper nesting of tags makes no sense to XML. This text is bold and italic In XML all elements must be properly nested within each other like this: This text is bold and italic

20 Microsoft XML Syntax XML Documents Must Have a Root Element All XML documents must contain a single tag pair to define a root element. All other elements must be within this root element. All elements can have sub elements (child elements). Sub elements must be correctly nested within their parent element:.....

21 Microsoft XML Syntax XML Attribute Values Must be Quoted With XML, it is illegal to omit quotation marks around attribute values. XML elements can have attributes in name/value pairs just like in HTML. In XML the attribute value must always be quoted. Students Students

22 Microsoft XML Syntax With XML, White Space is Preserved With XML, the white space in your document is not truncated. Comments in XML The syntax for writing comments in XML is similar to that of HTML.

23 Microsoft XML Sibling Elements My First XML Introduction to XML What is HTML What is XML XML Syntax Elements must have a closing tag Elements must be properly nested Sibling Elements: Title, prod, and chapter are siblings (or sister elements) because they have the same parent.

24 Microsoft Use of Elements vs. Attributes Data can be stored in child elements or in attributes. ABC XYZ female ABC XYZ

25 Microsoft Use of Elements vs. Attributes Some of the problems with using attributes are: attributes cannot contain multiple values (child elements can) attributes are not easily expandable (for future changes) attributes cannot describe structures (child elements can) attributes are more difficult to manipulate by program code attribute values are not easy to test against a Document Type Definition (DTD) - which is used to define the legal elements of an XML document

26 Microsoft Well Formed XML Document Well Formed XML Documents A "Well Formed" XML document has correct XML syntax. A "Well Formed" XML document is a document that conforms to the following: –XML documents must have a root element –XML elements must have a closing tag –XML tags are case sensitive –XML elements must be properly nested –XML attribute values must always be quoted

27 Microsoft Why usa a DTD? With a DTD, each of your XML files can carry a description of its own format. With a DTD, independent groups of people can agree to use a standard DTD for interchanging data. Your application can use a standard DTD to verify that the data you receive from the outside world is valid. You can also use a DTD to verify your own data.

28 Microsoft Valid XML Valid XML Documents –A "Valid" XML document also conforms to a DTD. –A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a Document Type Definition (DTD)

29 Microsoft Valid XML XML DTD –This is a statement of rules for an XML document –The purpose of a DTD is to define the legal building blocks of an XML document. –It helps ensure the accuracy of the information you collect. – It helps ensure that the information gathered is in the most usable format for your business needs.

30 Microsoft DTD A DTD can be declared inline inside an XML document, or as an external reference. Internal DTD Declaration If the DTD is declared inside the XML file, it should be wrapped in a DOCTYPE definition with the following syntax:

31 Microsoft DTD Terms

32 Microsoft Inline to DTD <!DOCTYPE note [ ]> Students Faculty Reminder Don't forget to learn XML !!!

33 Microsoft External DTD Declaration If the DTD is declared in an external file, it should be wrapped in a DOCTYPE definition with the following syntax: – File "note.dtd" which contains the DTD:

34 Microsoft DTD Explanation !DOCTYPE note defines that the root element of this document is note !ELEMENT note defines that the note element contains four elements: "to,from,heading,body“ !ELEMENT to defines the to element to be of type "#PCDATA" !ELEMENT from defines the from element to be of type "#PCDATA" !ELEMENT heading defines the heading element to be of type "#PCDATA" !ELEMENT body defines the body element to be of type "#PCDATA"

35 Microsoft DTD Elements DTD elements can be defined as follows: –Sometimes, you may want an element type to remain empty with no content to call its own –If you want your element to serve as a catch-all box that you can put anything in, you may want to use another type of content specification: ANY. –If you declare an element to contain ANY content, you allow that element type to hold any element or character data.

36 Microsoft Element Attribute –The attribute-list declaration begins with the !ATTLIST string, followed by white space. –Next is the element name, the associated attribute’s name, its type, and a default value. –For Example

37 Microsoft Element Attribute #REQUIRED means you must always include the attribute when the element is used. No specific default value for the attribute can be included in this case, so you must include a value for it in your – #IMPLIED means the attribute is optional. The attribute may be used in an element, but no default value is provided if the attribute isn’t used. –

38 Microsoft Element Attribute #FIXED means the attribute is optional, but if used, the attribute must always take on the default value assigned in the DTD. –

39 Microsoft Element and its attribute example

40 Microsoft DTD PCDATA PCDATA means parsed character data. Think of character data as the text found between the start tag and the end tag of an XML element. PCDATA is text that WILL be parsed by a parser.

41 Microsoft DTD CDATA CDATA means character data. CDATA is text that will NOT be parsed by a parser. Tags inside the text will NOT be treated as markup and entities will not be expanded.

42 Microsoft XML Schema XML Schema is an XML-based alternative to DTDs. An XML Schema describes the structure of an XML document. The XML Schema language is also referred to as XML Schema Definition (XSD).

43 Microsoft An XML Schema The purpose of an XML Schema is to define the legal building blocks of an XML document, just like a DTD. defines elements that can appear in a document defines attributes that can appear in a document defines which elements are child elements defines the order of child elements defines the number of child elements defines whether an element is empty or can include text defines data types for elements and attributes defines default and fixed values for elements and attributes

44 Microsoft XML Schema XML Schemas use XML Syntax You don't have to learn a new language You can use your XML editor to edit your Schema files You can use your XML parser to parse your Schema files You can manipulate your Schema with the XML DOM

45 Microsoft XML Schema Example The following example is an XML Schema file called "note.xsd" that defines the elements of the XML document ("note.xml")

46 Microsoft XML Schema The note element is a complex type because it contains other elements. The other elements (to, from, heading, body) are simple types because they do not contain other elements.

47 Microsoft XML Schema Simple element is an XML element that contains only text. It cannot contain any other elements or attributes. The text can be of many different types. It can be one of the types included in the XML Schema definition (boolean, string, date, etc.), or it can be a custom type that you can define yourself. You can also add restrictions (facets) to a data type in order to limit its content, or you can require the data to match a specific pattern.

48 Microsoft XML Schema The syntax for defining a simple element is: Where abc is the name of the element and xyz is the data type of the element. XML Schema has a lot of built-in data types. The most common types are: –xs:string –xs:decimal –xs:integer –xs:boolean –xs:date –xs:time

49 Microsoft XML Schema Here are some simple XML elements: Raj Here are the corresponding simple element definitions:

50 Microsoft XML Schema Simple elements may have a default value OR a fixed value specified. Default value is automatically assigned to the element when no other value is specified. In the following example the default value is "red": Fixed value is also automatically assigned to the element, and you cannot specify another value. In the following example the fixed value is "red":

51 Microsoft XML Schema The syntax for defining an attribute is: –Where abc is the name of the attribute and xyz specifies the data type of the attribute. –Simple elements can’t have attributes!

52 Microsoft XML Schema When an XML element or attribute has a data type defined, it puts restrictions on the element's or attribute's content. If an XML element is of type "xs:date" and contains a string like "Hello World", the element will not validate. With XML Schemas, you can also add your own restrictions to your XML elements and attributes.

53 Microsoft XML Schema The following example defines an element called "age" with a restriction. The value of age cannot be lower than 0 or greater than 120:

54 Microsoft XML Schema The example below defines an element called "car" with a restriction. The only acceptable values are: Audi, Ford, BMW: Note: In this case the type "carType" can be used by other elements because it is not a part of the "car" element.

55 Microsoft

56 Microsoft

57 Microsoft An XML Document