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.

Slides:



Advertisements
Similar presentations
Chapter 7 An Introduction to XML.
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)
XML Craig Stewart Dr. Alexandra I. Cristea
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.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
INF201 Fall2010 Intro. to Info. Technologies Department of Informatics University at Albany – SUNY Original Source: w3schools.com Prepared by Xiao Liang,
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
XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)
Introduction to XML: Yong Choi CSU Bakersfield.
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 XML Dr. Qusai Abuein June, 2012 XML Dr. Qusai Abuein 1 Part (I) XML Basics.
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
CREATED BY ChanoknanChinnanon PanissaraUsanachote
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Pemrograman Berbasis WEB XML -Aurelio Rahmadian- Sumber: w3cschools.com.
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.
Introduction to XML Data Management Issues. Types of data Structured Structured Semi-structured Semi-structured.
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.
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.
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,
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
How do I use HTML and XML to present information?.
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.
E0262 – MIS – Multimedia Storage Techniques XML (Extensible Markup Language  XML is a markup language for creating documents containing structured information.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation An Introduction to XML.
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.
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.
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:
Consuming eXtensible Markup Language (XML) feeds.
XML 2 Prepared by / Nael Alian Uinverity of Palestine Re. 1.
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 EXtensible Markup Language. Agenda Introduction to XML XML Rules XML Elements XML Attributes XML Validation XML Exercises XML Namespaces XML CDATA.
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 Introduction. Markup Language A markup language must specify What markup is allowed What markup is required How markup is to be distinguished from.
XML Basics A brief introduction to XML in general 1XML Basics.
IS446: Internet Software Development Dr. Azeddine Chikh.
XML Presented by Kushan Athukorala. 2 Agenda XML Overview Entity References Elements vs. Atributes XML Validation DTD XML Schema Linking XML and CSS XSLT.
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.
AJAX. Ajax  $.get  $.post  $.getJSON  $.ajax  json and xml  Looping over data results, success and error callbacks.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
VCE IT Theory Slideshows by Mark Kelly study design By Mark Kelly, vceit.com, Begin.
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.
XML. 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 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.
Javascript & jQuery XML.
What is XML?.
Presentation transcript:

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 of Information TechnologyT2-Lecture-3

eXtensible Markup Language (XML) Part - I For Lecture Material/Slides Thanks to:

Synopsis Introduction to XML How Can XML be Used? XML Tree XML Syntax Rules XML Elements XML Attributes XML Namespaces XML Encoding Viewing XML Files Displaying XML with CSS 3 T2-Lecture-3 Ahmed Mumtaz Mustehsan

Introduction to XML

5 XML was designed to transport and store data. HTML was designed to display data. Before we continue we should have a basic understanding of the HTML T2-Lecture-3 Ahmed Mumtaz Mustehsan

What is XML? 6 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 tags are not predefined. You must define your own tags XML is designed to be self-descriptive XML is a W3C Recommendation T2-Lecture-3 Ahmed Mumtaz Mustehsan

The Difference Between XML and HTML 7 XML is not a replacement for HTML. XML and HTML were designed with different goals: ◦ XML was designed to transport and store data, with focus on what data is ◦ HTML was designed to display data, with focus on how data looks HTML is about displaying information, while XML is about carrying information. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Does Not DO Anything 8 Maybe it is a little hard to understand, but XML does not DO anything. XML was created to structure, store, and transport information. The following example is a note to Mumtaz, from Tariq, stored as XML: ◦ Mumtaz Tariq Reminder Don't forget to attend the party on weekend! The note above is quite self descriptive. It has sender and receiver information, it also has a heading and a message body. But still, this XML document does not DO anything. It is just information wrapped in tags. Someone must write a piece of software to send, receive or display it. T2-Lecture-3 Ahmed Mumtaz Mustehsan

With XML we Invent our Own Tags 9 The tags in the example above (like and ) are not defined in any XML standard. These tags are "invented" by the author of this XML example. That is because the XML language has no predefined tags. The tags used in HTML are predefined. HTML documents can only use tags defined in the HTML standard (like,, etc.). XML allows the author to define his/her own tags and his/her own document structure. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML is Not a Replacement for HTML 10 XML is a complement to HTML. It is important to understand that XML is not a replacement for HTML. In most web applications, XML is used to transport data, while HTML is used to format and display the data. The best description of XML is: XML is a software- and-hardware-independent tool for carrying information. T2-Lecture-3 Ahmed Mumtaz Mustehsan

Role of XML 11 XML is a W3C Recommendation W3C announced XML standard on February 10, XML is Everywhere XML is now as important for the Web as HTML is to the foundation of the Web. XML is the most common tool that facilitate the data transmissions between all sorts of applications. T2-Lecture-3 Ahmed Mumtaz Mustehsan

Use of XML

How Can XML be Used? 13 XML is used to describe the data storage and sharing. How XML Separates Data from HTML? If we need to display dynamic data in our HTML document, it will take a lot of work to re-edit the HTML each time the data is changed. With XML, data can be stored in separate XML files. This way we can concentrate on using HTML/CSS for display and layout of pages with updated or modified data. No changes in the HTML is required With a few lines of JavaScript code, we can read an external XML file and update the data content of our web page. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Simplifies Data Sharing 14 One of the most time-consuming challenges for developers is to exchange data between incompatible systems over the Internet. XML data is stored in plain text format. That provides a software-and-hardware-independent way of storing data. So exchanging data as XML greatly reduces this complexity, since the data can be read by different incompatible applications. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Simplifies Platform Changes 15 Upgrading to new systems (hardware or software platforms), is always time consuming. Large amounts of data must be converted and incompatible data is often lost. XML data is stored in text format. This makes it easier to expand or upgrade to new operating systems, new applications, or new browsers, without losing data. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML extends the data Availability. 16 Different applications can access the data from HTML pages and also from XML data sources. With XML, the data can be available to all kinds of "reading machines" (Handheld computers, voice machines, news feeds, etc.), and that make the data more available for blind people, or people with other disabilities. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML is Used to Create New Internet Languages 17 A lot of new Internet languages are created with XML. Examples: XHTML WSDL for describing available web services WAP and WML as markup languages for handheld devices RSS languages for news feeds RDF and OWL for describing resources and ontology SMIL for describing multimedia for the web T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML is a future tool 18 If XML is used with care and sense it will be a major platform for data exchange on web. In future we might receive word processors, spreadsheet applications and databases that can read each other's data in XML format, without any conversion utilities in between. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Tree

XML Tree 20 XML documents form a tree structure that starts at "the root" and branches to "the leaves". Example XML Document XML documents use a self-describing and simple syntax: called declaration called declaration Mumtaz Tariq Reminder Don't forget to attend the party on weekend! The first line is the XML declaration. It defines the XML version (1.0) The next line describes the root element of the document (like saying: "this document is a note" ): T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Tree… 21 The next 4 lines describe 4 child elements of the root (to, from, heading, and body): Mumtaz Tariq Reminder Don't forget to attend the party on weekend! And finally the last line defines the end of the root element: we can assume, from this example, that the XML document contains a note to Mumtaz from Tariq XML is self-descriptive? T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Documents Form a Tree Structure 22 XML documents must contain a root element. This element is "the parent" of all other elements. The elements in an XML document form a document tree. The tree starts at the root and branches to the lowest level of the tree. All elements can have sub elements (child elements): ◦..... The terms parent, child, and sibling are used to describe the relationships between elements. Parent elements have children. Children at the same level are called siblings (brothers or sisters). All elements can have text content and attributes (just like in HTML). T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Documents Form a Tree Structure… 23 T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Documents Form a Tree Structure… 24 The above diagram may be represented in the XML as: ◦ Everyday Italian Giada De Laurentiis Harry Potter J K. Rowling Learning XML Erik T. Ray The root element in the example is. All elements in the document are contained within. The element has 4 children:,,,. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Syntax Rules

26 The syntax rules of XML are very simple and logical. The rules are easy to learn, and easy to use. All XML Elements Must Have a Closing Tag In HTML, some elements do not have to have a closing tag: ◦ This is a paragraph. In XML, it is illegal to omit the closing tag. Note: You might have noticed from the previous example that the XML declaration did not have a closing tag. This is not an error. The declaration is not a part of the XML document itself, and it has no closing tag. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Tags are Case Sensitive 27 XML tags are case sensitive. The tag is different from the tag. Opening and closing tags must be written with the same case: ◦ This is incorrect This is correct Note: "Opening and closing tags" are often referred to as "Start and end tags". Like HTML tags. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Elements Must be Properly Nested 28 In HTML, you might see improperly nested elements: ◦ This text is bold and italic must In XML, all elements must be properly nested within each other: ◦ This text is bold and italic In the example above, "Properly nested" simply means that since the element is opened inside the element, it must be closed inside the element. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Documents Must Have a Root Element 29 XML documents must contain one element that is the parent of all other elements. This element is called the root element T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Attribute Values Must be Quoted 30 XML elements can have attributes in name/value pairs just like in HTML. In XML, the attribute values must always be quoted. Study the two XML documents below. The first one is incorrect, the second is correct: “date not quoted” “date not quoted” mumtaz tariq mumtaz tariq The error in the first document is that the date attribute in the note element is not quoted. T2-Lecture-3 Ahmed Mumtaz Mustehsan

Entity References 31 Some characters have a special meaning in XML. If you place a character like "<" (Less Than) inside an XML element, it will generate an error because the parser interprets it as the start of a new element. This will generate an XML error: ◦ if salary To avoid this error, replace the "<" character with an entity reference: ◦ if salary < 1000 then T2-Lecture-3 Ahmed Mumtaz Mustehsan

Entity References… 32 There are 5 predefined entity references in XML: Note: Only the characters "<" and "&" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it to avoid inconsistency. T2-Lecture-3 Ahmed Mumtaz Mustehsan

Comments in XML 33 The syntax for writing comments in XML is similar to that of HTML. T2-Lecture-3 Ahmed Mumtaz Mustehsan

White-space is Preserved in XML 34 HTML truncates multiple white-space characters to one single white-space: T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Stores New Line as LF 35 Windows applications stores a new line as: carriage return and line feed (CR+LF). Unix and Mac OS uses LF. Old Mac systems uses CR. XML stores a new line as LF. Well Formed XML ◦ XML documents that conform to the syntax rules above are said to be "Well Formed" XML documents. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Elements

What is an XML Element? 37 What is an XML Element? An XML element is everything from the element's start tag to the element's end tag. (Including tags) An element can contain: other elements text attributes or a mix of all of the above... T2-Lecture-3 Ahmed Mumtaz Mustehsan

What is an XML Element? Example Harry Potter J K. Rowling Learning XML Erik T. Ray T2-Lecture-3 Ahmed Mumtaz Mustehsan

What is an XML Element? In the example above, and have element contents, because they contain other elements. also has an attribute (category="CHILDREN").,,, and have text content because they contain text. T2-Lecture-3 Ahmed Mumtaz Mustehsan

Empty XML Elements 40 An alternative syntax can be used for XML elements with no content: Instead of writing a book element (with no content) like this: ◦ It can be written like this: ◦ This sort of element syntax is called self-closing. T2-Lecture-3 Ahmed Mumtaz Mustehsan

XML Naming Rules 41 XML elements must follow naming rules: Names can contain letters, numbers, and other characters Names cannot start with a number or punctuation character Names cannot start with the letters xml (or XML, or Xml, etc) Names cannot contain spaces Any name can be used, there are no reserve words except XML !! T2-Lecture-3 Ahmed Mumtaz Mustehsan

Best Naming Practices 42 Make names descriptive:,. Make names short and simple, like this: not like this:. Avoid "-". If you name something "first-name," some software may think you want to subtract name from first. Avoid ".". If you name something "first.name," some software may think that "name" is a property of the object "first." Avoid ":". Colons are reserved to be used for something called namespaces (will be taught later). Non-English letters like éòá are perfectly legal in XML, but watch out for problems if your software doesn't support them. T2-Lecture-3 Ahmed Mumtaz Mustehsan

Naming Styles 43 There are no naming styles defined for XML elements. But here are some commonly used: If you choose a naming style, it is good to be consistent! XML documents often have a corresponding database. A good practice is to use the naming rules of your database for the elements in the XML documents. T2-Lecture-3 Ahmed Mumtaz Mustehsan

Common Errors for Element Naming Do not use white space when creating names for elements Element names cannot begin with a digit, although names can contain digits Only certain punctuation allowed – periods, colons, and hyphens T2-Lecture-3 Ahmed Mumtaz Mustehsan 44

Main Components of an XML Document Elements: Attributes: Entities: < (<) T2-Lecture-3 Ahmed Mumtaz Mustehsan 45

Review: The Basic Rules XML is case sensitive All start tags must have end tags Elements must be properly nested XML declaration is the first statement Every document must contain a root element Attribute values must have quotation marks Certain characters are reserved for parsing T2-Lecture-3 Ahmed Mumtaz Mustehsan 46

The End XML Part-I T2-Lecture-3 Thank You 1-47 T2-Lecture-3 Ahmed Mumtaz Mustehsan