Introduction to XML: www.w3schools.com Yong Choi CSU Bakersfield.

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

Ali Alshowaish w3schools. XML documents use a self-describing and simple syntax: The first line is the XML declaration. It defines the XML version (1.0)
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
INF201 Fall2010 Intro. to Info. Technologies Department of Informatics University at Albany – SUNY Original Source: w3schools.com Prepared by Xiao Liang,
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.
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
Tutorial 11 Creating XML Document
XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)
Upgrading to XHTML DECO 3001 Tutorial 1 – Part 1 Presented by Ji Soo Yoon 19 February 2004 Slides adopted from
XML Introduction By Hongming Yu Feb 6 th, Index Markup Language: SGML, HTML, XML An XML example Why is XML important XML introduction XML applications.
Introduction to XML Rashmi Kukanur. XML XML stands for Extensible Markup Language XML was designed to carry data XML and HTML designed with different.
Introducing XHTML: Module B: HTML to XHTML. Goals Understand how XHTML evolved as a language for Web delivery Understand the importance of DTDs Understand.
Introduction to XML This material is based heavily on the tutorial by the same name at
Introduce of XML Xiaoling Song CS157A. What is XML? XML stands for EXtensible Markup Language XML stands for EXtensible Markup Language XML is a markup.
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
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.
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Address: Course Page:
Introduction to XML 1. XML XML started out as a standard data exchange format for the Web Yet, it has quickly become the fundamental instrument in the.
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.
These Questions are copied from
 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,
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.
How do I use HTML and XML to present information?.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
XML eXtensible Markup Language. Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB.
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.
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.
1 Dr Alexiei Dingli XML Technologies XML. 2 XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
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.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
XML EXtensible Markup Language. Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA.
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.
What it is and how it works
XML Design Goals 1.XML must be easily usable over the Internet 2.XML must support a wide variety of applications 3.XML must be compatible with SGML 4.It.
XML Introduction. Markup Language A markup language must specify What markup is allowed What markup is required How markup is to be distinguished from.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
XML Extensible Markup Language. What is XML? o XML stands for EXtensible Markup Language o XML is a markup language much like HTML o XML was designed.
ASHIMA KALRA  INTRODUCTION OF XML INTRODUCTION OF XML  XML FEATURES XML FEATURES  XML SYNTAX XML SYNTAX  XML ELEMENTS XML ELEMENTS  XML ATTRIBUTES.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
IS444: Modern software development tools Dr. Azeddine Chikh.
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.
XP 1Creating Web Pages with XML Tutorial 1 New Perspectives on XML Tutorial 1 – Creating an XML Document.
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:

Introduction to XML: www.w3schools.com Yong Choi CSU Bakersfield

What is XML? XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data XML will be the most common tool for all data manipulation and data transmission. XML tags are not predefined in XML. You must define your own tags XML uses a Document Type Definition (DTD) or an XML Schema to describe the data XML with a DTD or XML Schema is designed to be self-descriptive

What is DTD? It defines the document structure with a list of legal elements. A DTD can be declared inline in your XML document, or as an external reference. Why use a DTD? With DTD, each of your XML files can carry a description of its own format with it. With a DTD, independent groups of people can agree to use a common 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.

The main difference between XML and HTML XML is not a replacement for HTML. XML and HTML were designed with different goals: XML was designed to describe data and to focus on what data is. HTML was designed to display data and to focus on how data looks. HTML is about displaying information, while XML is about describing information.

Example: A note to Tove from Jani <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> Just pure information wrapped in XML tags

XML is free and extensible XML tags are not predefined. You must "invent" your own tags. The tags used to mark up HTML documents and the structure of HTML documents are predefined. The author of HTML documents can only use tags that are defined in the HTML standard (like <p>, <h1>, etc.). XML allows the author to define his own tags and his own document structure. The tags in the example above (like <to> and <from>) are not defined in any XML standard. These tags are "invented" by the author of the XML document.

XML is a complement to HTML XML is not a replacement for HTML. It is important to understand that XML is not a replacement for HTML. In future Web development it is most likely that XML will be used to describe the data, while HTML will be used to format and display the same data. Best description of XML: XML is a cross-platform, software and hardware independent tool for transmitting information.

XML can Separate Data from HTML With XML, your data is stored outside your HTML. When HTML is used to display data, the data is stored inside your HTML. With XML, data can be stored in separate XML files. This way you can concentrate on using HTML for data layout and display, and be sure that changes in the underlying data will not require any changes to your HTML. XML data can also be stored inside HTML pages as "Data Islands". You can still concentrate on using HTML only for formatting and displaying the data.

XML is used to Exchange Data With XML, data can be exchanged between incompatible systems. 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. Especially in B2B (financial institutions)

An example XML document <?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>

First Line The XML declaration Defines the XML version and the character encoding used in the document. Conforms to the 1.0 specification of XML Uses the ISO-8859-1 (Latin-1/West European) character set.

Second and other lines The second line describes the root element of the document ( like it was saying: "this document is a note" Lines from 3 to 6 describe 4 child elements of the root to, from, heading, and body The last line defines the end of the root element

This figure shows available XML editors

XML Parsers An XML processor (also called XML parser) evaluates the document to make sure it conforms to all XML specifications for structure and syntax. XML parsers are strict and ensure XML code accepted by the parser will work the same everywhere. Microsoft’s parser is called MSXML and is built directly in IE versions 5.0 and above. Netscape developed its own parser, called Mozilla, which is built into version 6.0 and above.

Well-Formed and Valid XML Documents There are two categories of XML documents Well-formed Valid An XML document is well-formed if it contains no syntax errors and fulfills all of the specifications for XML code as defined by the W3C. An XML document is valid if it is well-formed and also satisfies the rules laid out in the DTD or schema attached to the document.

The Document Creation Process This figure shows the document creation process

This figure shows some XML applications

XML syntax vs. HTML syntax With XML, it is illegal to omit the closing tag. Paragraph tag <P> in HTML XML tags are case sensitive Unlike HTML, XML tags are case sensitive <Message>This is incorrect</message> <message>This is correct</message> All XML elements must be properly nested Improper nesting of tags makes no sense to XML. In HTML some elements can be improperly nested <b><i>This text is bold and italic</i></b>

XML syntax vs. HTML syntax All 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: <root> <child> <subchild>.....</subchild> </child> </root>

XML syntax vs. HTML syntax Attribute values must always be quoted With XML, it is illegal to omit quotation marks around attribute values.  <?xml version="1.0" encoding="ISO-8859-1"?> <note date="12/11/2002"> <to>Tove</to> <from>Jani</from> </note>

XML syntax vs. HTML syntax With XML, white space is preserved With XML, the white space in your document is not truncated. Using XML Hello              my name is Tove, Using HTML Hello my name is Tove, HTML strips off the white space. The syntax for writing comments in XML is similar to that of HTML. <!-- This is a comment -->

XML Elements XML Elements are Extensible XML documents can be extended to carry more information. XML Elements have Relationships Elements are related as parents and children. Elements have Content Elements can have different content types.

Extensible Extracted output by an application <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> Extracted output by an application MESSAGE To: Tove From: Jani Don't forget me this weekend!

Extensible <note> <date>2002-08-01</date> // new added information <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> Should the application break or crash because we added new information?

Relationships A description of a book 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

Relationships A description of the book in XML <book> <title>My First XML</title> <prod id="33-657" media="paper"></prod> <chapter>Introduction to XML <para>What is HTML</para> <para>What is XML</para> </chapter> <chapter>XML Syntax <para>Elements must have a closing tag</para> <para>Elements must be properly nested</para> </book>

Relationships Book is the root element. Title, prod, and chapter are child elements of book. Book is the parent element of title, prod, and chapter. Title, prod, and chapter are siblings (or sister elements) because they have the same parent.

Content In previous example, Only the prod element has attributes. book has element content, because it contains other elements. Chapter has mixed content because it contains both text and other elements. Para has simple content (or text content) because it contains only text. Prod has empty content, because it carries no information. Only the prod element has attributes. The attribute named id has the value "33-657". The attribute named media has the value "paper". 

Element Naming Names can contain letters, numbers, and other characters Names must not start with a number or punctuation character Names must not start with the letters xml (or XML or Xml ..) Names cannot contain spaces Any name can be used, no words are reserved, but the idea is to make names descriptive. Names with an underscore separator are nice.

XML Attributes XML elements can have attributes. From HTML: <IMG SRC="computer.gif">. The SRC attribute provides additional information about the IMG element. <file type="gif">computer.gif</file> Attribute values must always be enclosed in quotes either single or double quotes can be used If the attribute value itself contains double quotes, it is necessary to use single quotes or vice versa.

Use of Elements vs. Attributes Data can be stored in child elements or in attributes both below examples provide same information. Sex is an attribute <person sex="female"> <firstname>Anna</firstname> <lastname>Smith</lastname> </person> Sex is an element <person> <sex>female</sex>

Problems using Attributes 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 DTD <note day="12" month="11" year="2002" to="Tove" from="Jani" heading="Reminder" body="Don't forget me this weekend!"> </note>

Linking to a Style Sheet There are two main style sheet languages used with XML: Cascading Style Sheets (CSS) Extensible Style Sheets (XSL)

CSS Because HTML uses predefined tags, the meanings of these tags are well understood: The <p> element defines a paragraph and the <h1> element defines a heading; and the browser knows how to display them. Adding styles to HTML elements with CSS is simple. Telling a browser to display each element in a special font or color, is easy to do and easy for a browser to understand. 

XSL Because XML does not use predefined tags (we can use any tags we want), the meanings of these tags are not understood: <table> could mean an HTML table, a piece of furniture, or something else. A browser does not know how to display an XML document. Therefore there must be something in addition to the XML document that describes how the document should be displayed; and that is XSL!

XSL XSL is the preferred style sheet language of XML. XSL (the eXtensible Stylesheet Language) is far more sophisticated than CSS. Below is a fraction of the XML file, with an added XSL reference. <?xml-stylesheet type="text/xsl" href="simple.xsl"?>