Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.

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

eXtensible Markup Language
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.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
Document Type Definitions
CSE 190: Internet E-Commerce Lecture 17: XML, XSL.
XML Programming Introduction to XML ITC L EARNING O BJECTIVES  Be able to:  Understand XML technologies and their roles.  Understand different.
Thayer School of Engineering Dartmouth Lecture 2 Overview Web Services concept XML introduction Visual Studio.net.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
26-Jun-15 XML. 2 HTML and XML, I XML stands for eXtensible Markup Language HTML is used to mark up text so it can be displayed to users XML is used to.
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Tutorial 11 Creating XML Document
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.
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
Introducing XHTML: Module B: HTML to XHTML. Goals Understand how XHTML evolved as a language for Web delivery Understand the importance of DTDs Understand.
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.
XP Tutorial 9New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
CREATED BY ChanoknanChinnanon PanissaraUsanachote
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
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.
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
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,
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 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.
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.
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.
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.
XML Documents Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University Elements Attributes Comments PI Document.
IS432 Semi-Structured Data Lecture 2: DTD Dr. Gamal Al-Shorbagy.
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.
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.
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
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.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
19-Dec-15 XML 2 HTML and XML, I XML stands for eXtensible Markup Language HTML is used to mark up text so it can be displayed to users XML is used to.
Well Formed XML The basics. A Simple XML Document Smith Alice.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
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.
VCE IT Theory Slideshows by Mark Kelly study design By Mark Kelly, vceit.com, Begin.
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.
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.
Unit 4 Representing Web Data: XML
eXtensible Markup Language
Introduction to XML Mr. Majed Bouchahma
Chapter 7 Representing Web Data: XML
Introduction to XML Mr. Majed Bouchahma
eXtensible Markup Language
Presentation transcript:

Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad

15-Feb-16 XML

Introduction to XML 3 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

XML is Not a Replacement for HTML 4 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.

With XML You Invent Your Own Tags 5 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.

XML Separates Data from HTML 6 If you need to display dynamic data in your HTML document, it will take a lot of work to edit the HTML each time the data changes. With XML, data can be stored in separate XML files. This way you can concentrate on using HTML/CSS for display and layout, and be sure that changes in the underlying data will not require any changes to the HTML. With a few lines of JavaScript code, you can read an external XML file and update the data content of your web page.

XML Simplifies Data Transport 7 One of the most time-consuming challenges for developers is to exchange data between incompatible systems over the Internet. Exchanging data as XML greatly reduces this complexity, since the data can be read by different incompatible applications.

HTML and XML, I 8 XML stands for eXtensible Markup Language HTML is used to mark up text so it can be displayed to users XML is used to mark up data so it can be processed by computers HTML describes both structure (e.g.,, ) and appearance (e.g.,, ) XML describes only content, or “meaning” HTML uses a fixed, unchangeable set of tags In XML, you make up your own tags

HTML and XML, II 9 HTML and XML look similar, because they are both SGML languages (SGML = Standard Generalized Markup Language) Both HTML and XML use elements enclosed in tags (e.g. This is an element ) Both use tag attributes (e.g., ) Both use entities (<, >, &, ", &apos; ) More precisely, HTML is defined in SGML XML is a (very small) subset of SGML

HTML and XML, III 10 HTML is for humans HTML describes web pages You don’t want to see error messages about the web pages you visit Browsers ignore and/or correct as many HTML errors as they can, so HTML is often sloppy XML is for computers XML describes data The rules are strict and errors are not allowed In this way, XML is like a programming language Current versions of most browsers can display XML However, browser support of XML is spotty at best

XML-related technologies 11 DTD (Document Type Definition) and XML Schemas are used to define legal XML tags and their attributes for particular purposes CSS (Cascading Style Sheets) describe how to display HTML or XML in a browser XSLT (eXtensible Stylesheet Language Transformations) and XPath are used to translate from one form of XML to another DOM (Document Object Model), SAX (Simple API for XML, and JAXP (Java API for XML Processing) are all APIs for XML parsing

Example XML document 12 7/14/97 North Place, NX USA High Temp: 103 Low Temp: 70 Morning: Partly cloudy, Hazy Afternoon: Sunny & hot Evening: Clear and Cooler

Overall structure 13 An XML document may start with one or more processing instructions (PIs) or directives: Following the directives, there must be exactly one root element containing all the rest of the XML:...

XML building blocks 14 Aside from the directives, an XML document is built from: elements: high in 103 tags, in pairs: 103 attributes: 103 entities: Sunny & hot character data, which may be: parsed (processed as XML)--this is the default unparsed (all characters stand for themselves)

Elements and attributes 15 Attributes and elements are somewhat interchangeable Example using just elements: David Matuszek Example using attributes: You will find that elements are easier to use in your programs--this is a good reason to prefer them Attributes often contain metadata, such as unique IDs Generally speaking, browsers display only elements (values enclosed by tags), not tags and attributes

Well-formed XML 16 Every element must have both a start tag and an end tag, e.g.... But empty elements can be abbreviated:. XML tags are case sensitive XML tags may not begin with the letters xml, in any combination of cases Elements must be properly nested, e.g. not bold and italic Every XML document must have one and only one root element The values of attributes must be enclosed in single or double quotes, e.g. Character data cannot contain < or &

Entities 17 Five special characters must be written as entities: & for & (almost always necessary) < for < (almost always necessary) > for > (not usually necessary) " for " (necessary inside double quotes) &apos; for ' (necessary inside single quotes) These entities can be used even in places where they are not absolutely required These are the only predefined entities in XML

XML declaration 18 The XML declaration looks like this: The XML declaration is not required by browsers, but is required by most XML processors (so include it!) If present, the XML declaration must be first--not even whitespace should precede it Note that the brackets are version="1.0" is required (this is the only version so far) encoding can be "UTF-8" (ASCII) or "UTF-16" (Unicode), or something else, or it can be omitted standalone tells whether there is a separate DTD

XML Encoding XML documents can contain international characters, like Norwegian æøå, or French êèé. To avoid errors, you should specify the encoding used, or save your XML files as UTF-8. Unicode is an industry standard for character encoding of text documents. It de fi nes (nearly) every possible international character by a name and a number. Unicode has two variants: UTF-8 and UTF-16. UTF = Universal character set Transformation Format. 19

XML Encoding UTF-8 uses a single byte (8-bits) to represent commonly used characters and two (or three) bytes for the rest. UTF-16 uses two bytes (16 bits) for most characters, and three bytes for the rest. UTF-8 Web Standard UTF-8 is the standard character encoding on the web. UTF-8 is the default character encoding for HTML-5, CSS, JavaScript, PHP, SQL, and XML. 20

Processing instructions 21 PIs (Processing Instructions) may occur anywhere in the XML document (but usually first) A PI is a command to the program processing the XML document to handle it in a certain way XML documents are typically processed by more than one program Programs that do not recognize a given PI should just ignore it General format of a PI: Example:

Comments 22 Comments can be put anywhere in an XML document Comments are useful for: Explaining the structure of an XML document Commenting out parts of the XML during development and testing Comments are not elements and do not have an end tag The blanks after are optional The character sequence -- cannot occur in the comment The closing bracket must be --> Comments are not displayed by browsers, but can be seen by anyone who looks at the source code

CDATA 23 By default, all text inside an XML document is parsed You can force text to be treated as unparsed character data by enclosing it in Any characters, even & and <, can occur inside a CDATA Whitespace inside a CDATA is (usually) preserved The only real restriction is that the character sequence ]]> cannot occur inside a CDATA CDATA is useful when your text has a lot of illegal characters (for example, if your XML document contains some HTML text)

Names in XML 24 Names (as used for tags and attributes) must begin with a letter or underscore, and can consist of: Letters, both Roman (English) and foreign Digits, both Roman and foreign. (dot) - (hyphen) _ (underscore) : (colon) should be used only for namespaces Combining characters and extenders (not used in English)

Namespaces 25 Recall that DTDs are used to define the tags that can be used in an XML document An XML document may reference more than one DTD Namespaces are a way to specify which DTD defines a given tag XML, like Java, uses qualified names This helps to avoid collisions between names Java: myObject.myVariable XML: myDTD:myTag Note that XML uses a colon ( : ) rather than a dot (. )

Review of XML rules 26 Start with XML is case sensitive You must have exactly one root element that encloses all the rest of the XML Every element must have a closing tag Elements must be properly nested Attribute values must be enclosed in double or single quotation marks There are only five predeclared entities

Another well-structured example 27 This is the great American novel. It was a dark and stormy night. Suddenly, a shot rang out!

Valid XML 28 You can make up your own XML tags and attributes, but......any program that uses the XML must know what to expect! A DTD (Document Type Definition) defines what tags are legal and where they can occur in the XML An XML document does not require a DTD XML is well-structured if it follows the rules given earlier In addition, XML is valid if it declares a DTD and conforms to that DTD A DTD can be included in the XML, but is typically a separate document Errors in XML documents will stop XML programs Some alternatives to DTDs are XML Schemas and RELAX NG

Viewing XML 29 XML is designed to be processed by computer programs, not to be displayed to humans Nevertheless, almost all current browsers can display XML documents They don’t all display it the same way They may not display it at all if it has errors For best results, update your browsers to the newest available versions Remember: HTML is designed to be viewed, XML is designed to be used

Displaying your XML Files with CSS With CSS (Cascading Style Sheets) you can add display information to an XML document. Empire Burlesque Bob Dylan USA Columbia

CATALOG { background-color: #ffffff; width: 100%; } CD { display: block; margin-bottom: 30pt; margin-left: 0; } 31

TITLE { color: #FF0000; font-size: 20pt; } ARTIST { color: #0000FF; font-size: 20pt; } 32

COUNTRY,PRICE,YEAR,COMPANY { display: block; color: #000000; margin-left: 20pt; } 33