Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Technologies XML Basics  What is XML?  Why use XML?  How to write XML? 1XML Technologies - 2012 - David Raponi.

Similar presentations


Presentation on theme: "XML Technologies XML Basics  What is XML?  Why use XML?  How to write XML? 1XML Technologies - 2012 - David Raponi."— Presentation transcript:

1 XML Technologies XML Basics  What is XML?  Why use XML?  How to write XML? 1XML Technologies - 2012 - David Raponi

2 2 Week 1: XML Basics > 1. What is XML? 1. What is XML? eXtensible Markup Language Markup: text + annotations  This is a sentence. Extensible: A language for creating new markup languages  I can make up anything

3 3XML Technologies - 2012 - David Raponi Week 1: XML Basics > 1. What is XML? An example: Romolo Silvia David

4 4XML Technologies - 2012 - David Raponi Week 1: XML Basics > 1. What is XML? What it is and what it isn’t… It is self-descriptive (commonsense tag names) Focuses on STORING and DEFINING data Focuses also on ORGANIZING data for easy manipulation It does not handle displaying of data… that’s HTML’s job It is not a processing “code” of any kind It is not a version of XHTML

5 5XML Technologies - 2012 - David Raponi Week 1: XML Basics > 1. What is XML? Advantages of XML Easily read by humans Simple and lightweight Bridges a gab between simple lists and overkill databases Platform independent Lots of technologies exist to work with XML Anal-retentively dependable!

6 6XML Technologies - 2012 - David Raponi Week 1: XML Basics > 1. What is XML? Markup and so much more… To Summarize, XML is: - a markup language that allows for simple and contextual storage of data that can be easily read and manipulated. - but on its own, it doesn’t actually DO anything. It’s just a bunch of information, like a grocery list.

7 7XML Technologies - 2012 - David Raponi Week 1: XML Basics > 1. What is XML? Markup and so much more… Another amazing aspect: XML can be used to create new markup languages This is because the tags are named however you wish, and then “definitions” (next week) can be made for those new tags.

8 8XML Technologies - 2012 - David Raponi Week 1: XML Basics > 1. What is XML? Example revisited: What do we notice? Romolo Silvia David

9 9XML Technologies - 2012 - David Raponi Week 1: XML Basics > 1. What is XML? Initial observations: 1.Requires an initial declaration 2.Made up of elements (open + close tags) 3.Tags may contain attributes 4.There is a nesting structure 5.Can can create your own elements (only a very few naming restrictions apply)

10 10XML Technologies - 2012 - David Raponi Week 1: XML Basics > 1. What is XML? A quick comparison: Romolo David Silvia Q: Is it all the same? Does it matter? Is there another way to write it out?

11 11XML Technologies - 2012 - David Raponi Week 1: XML Basics > 2. Why use XML? 2. Why use XML? Since XML is… Lightweight Self-definable Platform independent Great for organizing information … we can…

12 12XML Technologies - 2012 - David Raponi Week 1: XML Basics > 2. Why use XML? What can you do with XML? 1.Create Twitter feeds 2.Probably everything on Facebook 3.Make scalable graphics (vector images) 4.Run an entire website (no HTML files!) 5.Host fun XML parties… ? 6.Program Documents (get ready to have your minds blown…) 7.Transfer data quickly (webservices)

13 13XML Technologies - 2012 - David Raponi Week 1: XML Basics > 2. Why use XML? What can you do with XML? 8.Keep data and design separate (quick and simplified updates!) 9.Quick storage of data (mini-database) 10.Sending out and reading in info (RSS, podasts) 11.Quick referencing (saving settings) 12.Smaller scale CMSs 13.Blogs

14 14XML Technologies - 2012 - David Raponi Week 1: XML Basics > 2. Why use XML? When NOT to use XML? 1.When a dedicated database is warranted 2.When display is most important factor 3.Basically whenever another technology can get the job done faster.

15 15XML Technologies - 2012 - David Raponi Week 1: XML Basics > 2. Why use XML? When NOT to use XML? Please note: you will not use every technology you learn in this program on a daily basis. It very much depends on your future career. Making simple sites? Not much XML involved. Working for dedicated web services, data industries (banks, hospitals, etc) or in IT? Lots of XML!

16 16XML Technologies - 2012 - David Raponi Week 1: XML Basics > 3. How to write XML? 3. How to write XML 1.Declaration and root 2.Reserved words 3.Special characters 4.Elements and attributes 5.Nesting 6.Must be “Well-Formed”

17 17XML Technologies - 2012 - David Raponi Week 1: XML Basics > 3. How to write XML? Declaration 1.Declaration and the root 2.Reserved words 3.Special characters 4.Elements and attributes 5.Nesting 6.Must be “Well-Formed” Each XML document must begin with a declaration. This tells the program (in our case, the browser) to interpret it as XML (no closing tag!) Options include: encoding=“utf-8” (or “ISO-8859-1”) standalone=“yes” (or “no”) o Yes: the DTD is located internally o No: the DTD is external (default)

18 18XML Technologies - 2012 - David Raponi Week 1: XML Basics > 3. How to write XML? Declaration 1.Declaration and the root 2.Reserved words 3.Special characters 4.Elements and attributes 5.Nesting 6.Must be “Well-Formed” Each XML document must also have a root element within which everything else is found. … </elementName

19 19XML Technologies - 2012 - David Raponi Week 1: XML Basics > 3. How to write XML? 3. How to write XML 1.Declaration and the root 2.Reserved words 3.Special characters 4.Elements and attributes 5.Nesting 6.Must be “Well-Formed” There are no reserved words in XML! However, you cannot: Begin with a number Begin with punctuation Have any spaces Begin with “xml” Good: Bad:

20 20XML Technologies - 2012 - David Raponi Week 1: XML Basics > 3. How to write XML? 3. How to write XML 1.Declaration and the root 2.Reserved words 3.Special characters 4.Elements and attributes 5.Nesting 6.Must be “Well-Formed” There are a few characters that should be replaced as follows: &  & <  < >  > ‘  &apos; “  &quote; (except for in attributes) I’m already lying to you: only the first two (& and <) are strict no-nos. Everything else is “good practice” to make life easier.

21 21XML Technologies - 2012 - David Raponi Week 1: XML Basics > 3. How to write XML? 3. How to write XML 1.Declaration and the root 2.Reserved words 3.Special characters 4.Elements and attributes 5.Nesting 6.Must be “Well-Formed” An element consists of an opening and closing tag (like in HTML) of the same case. An element can contain any number of attributes with values wrapped in matching quotes. Good: Bad: Note: whenever possible, avoid attributes. They should be reserved for “metadata”.

22 22XML Technologies - 2012 - David Raponi Week 1: XML Basics > 3. How to write XML? 3. How to write XML 1.Declaration and the root 2.Reserved words 3.Special characters 4.Elements and attributes 5.Nesting 6.Must be “Well-Formed” Open and close tags as you would in HTML, that is: In the proper order. My Title  This causes kittens to explode  My Title  Kittens live another day

23 23XML Technologies - 2012 - David Raponi Week 1: XML Basics > 3. How to write XML? 3. How to write XML 1.Declaration and the root 2.Reserved words 3.Special characters 4.Elements and attributes 5.Nesting 6.Must be “Well-Formed” To be well-formed, XML must PHYSICALLY be written correctly. It may or may not live up to the pre-determined requirements (it will not validate), but it is at least an honest and true XML document: Must include initial declaration Must have a root element that captures everything else All tags must be closed All attribute values must be in quotes No illegal characters present No illegally named elements

24 24XML Technologies - 2012 - David Raponi Week 1: XML Basics > 3. How to write XML? Final remarks Remember, XML doesn’t just store data, it organizes it. The organizational approach of an XML document should be carefully considered since the structure itself can also be thought of as data. HTML JS 1 JS 2 CSS PHP HTML JS 1 JS 2 CSS PHP Technically, the data is the same, but the 2 nd structure reveals more information!


Download ppt "XML Technologies XML Basics  What is XML?  Why use XML?  How to write XML? 1XML Technologies - 2012 - David Raponi."

Similar presentations


Ads by Google