XML 28-Dec-17.

Slides:



Advertisements
Similar presentations
Chapter 7 An Introduction to XML.
Advertisements

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.
eXtensible Markup Language
XML INTRODUCTION Prepared by Hongming Yu Modified by Fernando Farfán.
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.
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
Document Type Definitions
IS 373—Web Standards Todd Will
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
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.
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
Introduction to XML: Yong Choi CSU Bakersfield.
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.
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
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.
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.
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.
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.
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 About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
Tutorial 1: XML Creating an XML Document. 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content.
Electronic Commerce COMP3210 Session 4: Designing, Building and Evaluating e-Commerce Initiatives – Part II Dr. Paul Walcott Department of Computer Science,
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.
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.
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 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.
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.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
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 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
XML QUESTIONS AND ANSWERS
eXtensible Markup Language
Introduction to XML Mr. Majed Bouchahma
Chapter 7 Representing Web Data: XML
Creating an XML Document
Introducing HTML & XHTML:
XML Introduction By Hongming Yu Feb 6th, 2002.
Introduction to XML Mr. Majed Bouchahma
What is XML?.
eXtensible Markup Language
Allyson Falkner Spokane County ISD
Document Type Definition (DTD)
Presentation transcript:

XML 28-Dec-17

What is XML? XML stands for EXtensible Markup Language XML is a markup language much like HTML More accurately defined as a metalanguage XML was designed to describe data

Historical Development SGML( Standard Generalized Markup Language) XML HTML MusicXML . . . MathML XHTML CML RSS XBRL Comp Sci 346 12/28/2017

What is XML? XML tags are not predefined. You define your own tags depending on the application 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 XML is a W3C Recommendation - 1998

Difference Between XML and HTML XML was designed to carry data. 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.

XML Does Not DO Anything XML was not designed to DO anything. XML was created to structure, store and to send information.

More XML 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. XML allows the author to define their own tags and their 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 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. 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 is Used to Exchange Data With XML, data can be exchanged between incompatible systems. 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.

XML 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. This makes it much easier to create data that different applications can work with. It also makes it easier to expand or upgrade a system to new operating systems, servers, applications, and new browsers. 

XML Can Be Used to Store Data With XML, plain text files can be used to store data. XML can also be used to store data in files or in databases. Applications can be written to store and retrieve information from the store, and generic applications can be used to display the data.

Editors XML files can be edited using any text editor: Windows: Notepad, NotePad++, EditPad Lite, etc Mac OS: Text Wrangler, BBEdit, TextMate Linux: Emacs, VIM, Pico, etc.

Viewing XML Files in a Web Browser XML documents can be opened in Internet Explorer or in Firefox. If there are no syntax errors: IE and Firefox will display the document’s contents in an expandable/collapsible outline format including all markup tags.

Style Sheets & XML There are two main style sheet languages used with XML: Cascading Style Sheets (CSS) and Extensible Style Sheets (XSL) The important benefits to using style sheets are the same as using them with XHTML docs.

A sample XML document <?xml version="1.0" encoding=“UTF-8"?> <customers> <name>Fred Flintstone</name> <street>123 Main St.</street> <city>Lansing</city> <state>MI</state> <zip>48901</zip> <phone>517-123-4567</phone> </customers>

Introduction to 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 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 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 The tags used in HTML are predefined. HTML documents can only use tags defined in the HTML standard (like <p>, <h1>, etc.). XML allows the author to define his/her own tags and his/her own document structure.

XML Separates Data from HTML 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 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 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. <p>, <h2>, <em>) and appearance (e.g. <br>, <font>, <i>) XML describes only content, or “meaning” In XML, you make up your own tags HTML uses a fixed, unchangeable set of tags

Difference between XML and HTML XML was designed to carry data, not displaying data XML is not a replacement for HTML. 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, XML is about describing information. XML Introdution

An example of XML <?xml version="1.0"?> <products> <product id="PRO001"> <name>Coca Cola</name> <price>5000</price> </product> <product id="PRO002"> <name>Pepsi</name> <price>4500</price> <product id="PRO003"> <name>Number One</name> <price>5500</price> </products> XML Introdution

HTML and XML, II 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. <body>This is an element</body>) Both use tag attributes (e.g., <font face="Verdana" size="+1" color="red">) Both use entities (<, >, &, ", &apos;) More precisely, HTML is defined in SGML XML is a (very small) subset of SGML

HTML and XML, III HTML is for humans XML is for computers 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

SGML(ISO 8879) Standard Generalized Markup Language The international standard for defining descriptions of structure and content in text documents Interchangeable: device-independent, system-independent Tags are not predefined Using DTD to validate the structure of the document Large, powerful, and very complex Heavily used in industrial and commercial for over a decade XML Introdution

HTML(RFC 1866) HyperText Markup Language A small SGML application used on web (a DTD and a set of processing conventions) Can only use a predefined set of tags XML Introdution

What Is XML? eXtensible Markup Language A simplified version of SGML Maintains the most useful parts of SGML Designed so that SGML can be delivered over the Web XHTML -- a reformulation of HTML 4 in XML 1.0 XML Introdution

XML Syntax All XML elements must have a closing tag XML tags are case sensitive All XML elements must be properly nested All XML documents must have a root tag Attribute values must always be quoted With XML, white space is preserved With XML, a new line is always stored as LF XML Introdution

XML-related technologies 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 <?xml version="1.0"?> <weatherReport> <date>7/14/97</date> <city>North Place</city>, <state>NX</state> <country>USA</country> High Temp: <high scale="F">103</high> Low Temp: <low scale="F">70</low> Morning: <morning>Partly cloudy, Hazy</morning> Afternoon: <afternoon>Sunny & hot</afternoon> Evening: <evening>Clear and Cooler</evening> </weatherReport>

The Basic Rules XML is case sensitive <Message>This is incorrect</message> <message>This is correct</message>

The Basic Rules Empty Element All start tags must have end tags <composer>Mozart <composer>Mozart</composer> Empty Element <BR></BR> <BR/> <img align=“center” src=“logo.gif”/> <composer name=“Mozart”></composer> <composer name=“Mozart”/>

The Basic Rules Elements must be properly nested <b><i>This is incorrect nesting</b></i> <b><i>This is correct nesting</i></b>

The Basic Rules XML declaration must be the first statement <?xml version="1.0" encoding="ISO-8859-1" stAandalone="yes"?>

The Basic Rules <root> <child> Every document must contain a root element <root> <child> <subchild>.....</subchild> </child> </root>

The Basic Rules <note date="12/11/2007"> Attribute values must be quoted with inverted commas <note date="12/11/2007"> <to>Ani</to> <from>John</from> </note>

The Basic Rules Certain characters are reserved for parsing <message>if salary < 1000 then</message>

Predefined entities < less than > greater than & & &ampersand &apos; ' apostrophe " " quotation mark

XML Building blocks--Prolog The part of an XML document that precedes the XML data Includes A declaration: version [, encoding, standalone] An optional DTD (Document Type Definition ) Example <?xml version=“1.0” encoding=“UTF-8” standalone=“yes”?> XML Introdution

Tags Tags are used to specify a name for a given piece of information. A tag consists of opening and closing angular brackets (<>) that enclose the name of the tag. Example <EMP_NAME>Nick Shaw</EMP_NAME> XML Introdution

Elements Elements are represented using tags. An XML document must always have a root element. General format: <element> … </element> Empty element: <empty-Element /> Example <Authorname>John Smith</Authorname> XML Introdution

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: element content, mixed content, simple content, or empty content and attributes XML elements must follow the naming rules XML Introdution

Content Content refers to the information represented by the elements of an XML document. Character or data content Element content Combination or mixed content Example <BOOKNAME>The Painted House</BOOKNAME> XML Introdution

Attributes Located in the start tag of elements Provide additional information about elements Often provide information that is not a part of data Must be enclosed in quotes Should I use an element or an attribute? metadata (data about data) should be stored as attributes, and that data itself should be stored as elements XML Introdution

Entities An entity is a name that is associated with a block of data.. Internal Entities: < , >… General Entities General entities are declared in Document Type Definitions (DTD) Example <! ENTITY nyt "The Times of India."> For more information, please visit &nyt; Thank you! Parameter Entities Are only declared and used in DTDs <!ENTITY % bool ("yes | no")> <ATTLIST membership (%bool;)> XML Introdution

Overall structure An XML document may start with one or more processing instructions (PIs) or directives: <?xml version="1.0"?> <?xml-stylesheet type="text/css" href="ss.css"?> Following the directives, there must be exactly one root element containing all the rest of the XML: <weatherReport> ... </weatherReport>

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

Elements and attributes Attributes and elements are somewhat interchangeable Example using just elements: <name> <first>David</first> <last>Matuszek</last> </name> Example using attributes: <name first="David" last="Matuszek"></name> 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 Every element must have both a start tag and an end tag, e.g. <name> ... </name> But empty elements can be abbreviated: <break />. 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 <b><i>bold and italic</b></i> 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. <time unit="days"> Character data cannot contain < or &

Entities 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 The XML declaration looks like this: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 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 <? and ?> 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 defines (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.

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.

Processing instructions 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: <?target instructions?> Example: <?xml-stylesheet type="text/css" href="mySheet.css"?>

Comments <!-- This is a comment in both HTML and XML --> 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 <!-- and before --> 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 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 <![CDATA[ ... ]]> 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 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 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 Start with <?xml version="1"?> 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 <novel> <foreword> <paragraph> This is the great American novel. </paragraph> </foreword> <chapter number="1"> <paragraph>It was a dark and stormy night. </paragraph> <paragraph>Suddenly, a shot rang out! </paragraph> </chapter> </novel>

Valid XML 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 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. <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="cd_catalog.css"?> <CATALOG>   <CD>     <TITLE>Empire Burlesque</TITLE>     <ARTIST>Bob Dylan</ARTIST>     <COUNTRY>USA</COUNTRY>     <COMPANY>Columbia</COMPANY>     <PRICE>10.90</PRICE>     <YEAR>1985</YEAR>   </CD> </CATALOG>

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

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

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

Easily Processed Why Is XML Important? Plain Text Easy to edit Platform independent Data Identification Tell you what kind of data you have Can be used in different ways by different applications Easily Processed Vendor-neutral standard XML Introdution

Inherently style-free XSL---Extensible Stylesheet Language Why Is XML Important? Stylability Inherently style-free XSL---Extensible Stylesheet Language Different XSL formats can then be used to display the same data in different ways Inline Reusability Can be composed from separate entities Modularize your documents XML Introdution

Linkability -- XLink and XPointer Simple unidirectional hyperlinks Why is XML important? Linkability -- XLink and XPointer Simple unidirectional hyperlinks Two-way links Multiple-target links “Expanding” links Hierarchical Faster to access Easier to rearrange XML Introdution

XML Application1—Separate data XML can Separate Data from HTML Store data in separate XML files Using HTML for layout and display Using Data Islands Data Islands can be bound to HTML elements Benefits: Changes in the underlying data will not require any changes to your HTML XML Introdution

XML Application2—Exchange data XML is used to Exchange Data Text format Software-independent, hardware-independent Exchange data between incompatible systems, given that they agree on the same tag definition. Can be read by many different types of applications Benefits: Reduce the complexity of interpreting data Easier to expand and upgrade a system XML Introdution

XML Application3—Store Data XML can be used to Store Data Plain text file Store data in files or databases Application can be written to store and retrieve information from the store Other clients and applications can access your XML files as data sources Benefits: Accessible to more applications XML Introdution

XML Application4—Create new language XML can be used to Create new Languages WML (Wireless Markup Language) used to markup Internet applications for handheld devices like mobile phones (WAP) MusicXML used to publishing musical scores RSS. MathML. XML Introdution

Overview XML and Structured Data Pre-XML representation of data: XML representation of the same data: “PO-1234”,”CUST001”,”X9876”,”5”,”14.98” <PURCHASE_ORDER> <PO_NUM> PO-1234 </PO_NUM> <CUST_ID> CUST001 </CUST_ID> <ITEM_NUM> X9876 </ITEM_NUM> <QUANTITY> 5 </QUANTITY> <PRICE> 14.98 </PRICE> </PURCHASE_ORDER>

Overview Benefits of XML Open W3C standard Representation of data across heterogeneous environments Cross platform Allows for high degree of interoperability Strict rules Syntax Structure Case sensitive

Overview Who Uses XML? Submissions by Technologies using XML Microsoft IBM Hewlett-Packard Fujitsu Laboratories Sun Microsystems Netscape (AOL), and others… Technologies using XML SOAP, ebXML, BizTalk, WebSphere, many others…

Syntax and Structure Components of an XML Document Elements Each element has a beginning and ending tag <TAG_NAME>...</TAG_NAME> Elements can be empty (<TAG_NAME />) Attributes Describes an element; e.g. data type, data range, etc. Can only appear on beginning tag Processing instructions Encoding specification (Unicode by default) Namespace declaration Schema declaration

Syntax and Structure Components of an XML Document <?xml version=“1.0” ?> <?xml-stylesheet type="text/xsl” href=“template.xsl"?> <ROOT> <ELEMENT1><SUBELEMENT1 /><SUBELEMENT2 /></ELEMENT1> <ELEMENT2> </ELEMENT2> <ELEMENT3 type=‘string’> </ELEMENT3> <ELEMENT4 type=‘integer’ value=‘9.3’> </ELEMENT4> </ROOT> Elements with Attributes Elements Prologue (processing instructions)

Syntax and Structure Rules For Well-Formed XML There must be one, and only one, root element Sub-elements must be properly nested A tag must end within the tag in which it was started Attributes are optional Defined by an optional schema Attribute values must be enclosed in “” or ‘’ Processing instructions are optional XML is case-sensitive <tag> and <TAG> are not the same type of element

Comp Sci 346 12/28/2017

Comp Sci 346 12/28/2017