1 / 15

XML

XML. XML. XML – A tool that can be used to create markup languages Developers can create application specific markup languages Open standard. Benefits of XML. create “self describing” data create type rules style is separate from data. An XML Document. Runners profile.

hachi
Télécharger la présentation

XML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML

  2. XML • XML – A tool that can be used to create markup languages • Developers can create application specific markup languages • Open standard

  3. Benefits of XML • create “self describing” data • create type rules • style is separate from data

  4. An XML Document • Runners profile <?xml version = "1.0"?> <runner-profile> <name>Fred Bloggs</name> <club>Napier Road Runners</club> <description>Fred took up racing when he was ....</description> <pb-list> <distance>10 K</distance> <time>39:00</time> <distance>Half Marathon</distance> <time>1:32:00</time> <distance>Marathon</distance> <time>2:59:59</time> </pb-list> </runner-profile>

  5. XML – Content Entities • Similar idea to variables <?xml version = "1.0"?> <runner-profile> <name>Fred Bloggs</name> <club>Napier Road Runners</club> <description>Fred took up racing when he was ....</description> <pb-list> <distance>10 K</distance> <time>39:00</time> <distance>Half Marathon</distance> <time>1:32:00</time> <distance>Marathon</distance> <time>2:59:59</time> </pb-list> <favourite-event> <distance> Marathon </distance> <time> 2:59:59</time> </favourite-event> </runner-profile>

  6. <?xml version = "1.0"?> <!DOCTYPE runner-profile [ <!ENTITY marathonPB "2:59:59"> <!ENTITY bio SYSTEM "biography.txt"> ]> <runner-profile> <name> Fred Bloggs </name> <club> Napier Road Runners </club> <description> &bio; </description> <pb-list> <distance> 10 K </distance> <time> 39:00 </time> <distance> Half Marathon </distance> <time> 1:32:00 </time> <distance> Marathon </distance> <time> &marathonPB; </time> </pb-list> <favourite-event> <distance> Marathon </distance> <time> &marathonPB; </time> </favourite-event> </runner-profile>

  7. XML – Content Entities

  8. An XML Document • Entered as a plain text file • Save a .xml

  9. An XML Document • Can be viewed in a web browser

  10. XML Docs – The Declaration • Declaration always appears on the first line • Begins with … <?xml • … and ends with ?> • To give … <?xml ?>

  11. XML Docs – The Declaration • The XML declaration … <?xml ?> • Can take three optional parameters • version – only 1 at the moment • encoding – defines the character set • standalone – value is “yes” or “no”. Determines whether all of the information required for validation is contained in this document or whether external document type definitions are required

  12. XML - Adding Style • Link to a style sheet … <?xml-stylesheet type = "text/css" href = "runner.css" ?> • … and then specify the styles * { font-family: arial; } name { font-size: 16pt; color: red; display: block; } club { font-size: 12pt; color: green; display: block; }

  13. XML – Adding Style • Instead of this …

  14. XML – Adding Style • You get this …

  15. Lecture Slides • www.dcs.napier.ac.uk/~owens/wpt/lectures/wptlecture7.ppt

More Related