Presentation is loading. Please wait.

Presentation is loading. Please wait.

© De Montfort University, 20011 XML – a meta language Howell Istance and Peter Norris School of Computing De Montfort University.

Similar presentations


Presentation on theme: "© De Montfort University, 20011 XML – a meta language Howell Istance and Peter Norris School of Computing De Montfort University."— Presentation transcript:

1 © De Montfort University, 20011 XML – a meta language Howell Istance and Peter Norris School of Computing De Montfort University

2 © De Montfort University, 20032 Origins of HTML Initial set of tags defined to do a limited job of cross referencing scientific papers Little semantic content in tags, although has meaning in terms of what tag refers to Tag set was small and user community of html grew quickly – html was easy to learn and use

3 © De Montfort University, 20033 HTML Tags in HTML concerned with presentation of data Tags have no semantic meaning: indicates ‘header’ but contents of document could be anything Search engines rely on tag to provide keywords, no means of discerning content from marked up document Definition of tags is not extensible Cascading style sheets provide some separation of content and presentation One of original aims of SGML was complete separation of content and presentation

4 © De Montfort University, 20034 XML (eXtensible Markup Language) Simplified version of SGML, enabling users to define their own language XML is not a tag set, but a meta language Tags not concerned with how to render data, but instead define content –(HTML) indicates that text is bold –(XML) indicates that data is about employees Definition is either implicit (deduced from document structure) or is explicit (defined in Document Type Definition or DTD)

5 © De Montfort University, 20035 Student List 9906789 Adam adam@unl.ac.uk yes - final 9806791 Adrian adrian@unl.ac.uk no 9906789 Adam adam@unl.ac.uk yes 9806791 Adrian adrian@unl.ac.uk no students.html students.xml Specifies presentationSpecifies data structure

6 © De Montfort University, 20036 Student List 9906789 Adam adam@unl.ac.uk yes - final 9806791 Adrian adrian@unl.ac.uk no HTML Document ( good for formatting) What is “yes”? What is “no”? Data and presentation logic mixed

7 © De Montfort University, 20037 9906789 Adam adam@unl.ac.uk yes 9806791 Adrian adrian@unl.ac.uk no XML Document ( good for describing data) Data is self-describing custom tags describe content (define your own tags) easy to locate data (e.g. all BSC students) Only data

8 © De Montfort University, 20038 xml mark-up Start tag possibly containing attributes and values eg, End tag eg Empty tag eg Document type declaration eg xml declaration eg Comment

9 © De Montfort University, 20039 Elements and trees Elements are house, downstairs and upstairs downstairs and upstairs are the ‘content’ of the element house downstairs and upstairs themselves have no content downstairs and upstairs are child elements of the root element house

10 © De Montfort University, 200310 Xml document Root node nested node list Child node Xml node structure

11 © De Montfort University, 200311 Xml document house downstairs upstairs kitchen Dining_room bathroom bedroom Xml node structure bedroom larder

12 © De Montfort University, 200312 Well formed and valid xml document is ‘well-formed’ if the implicit structure in the document is not ambiguous xml document is ‘valid’ if it conforms to a set of rules which defines what each element is permitted to contain

13 © De Montfort University, 200313 Text nodes The content of elements may be other elements or text The text Rather Gloomy and Brightly lit are each text nodes Rather gloomy Brightly lit

14 © De Montfort University, 200314 Attributes and values Attribute is a means of providing information about an element, has a name (postcode)and a value (“LE1 9BH”) There may be several attributes, all must have unique names, order in which they appear not important Rather gloomy Brightly lit

15 © De Montfort University, 200315 entities << && >> "“ '‘ Sequence of chars which the parser will replace with the symbol shown Note ; to end sequence (x < y) && (y < z)

16 © De Montfort University, 200316 Rules for well formed xml There must be exactly one root element Element start tags must have a matching closing tag Elements may nest but must not overlap Attribute values must be in matching quotes Element may not have two attributes with the same name If present, the xml declaration must begin the document Comments and processing instructions must not appear in tags Element and attribute values must not contain < and & Entities must not be used unless they have been declared

17 © De Montfort University, 200317 Valid xml DTD defines permissible syntax of a document using extended BNF Either Public or System Public – used by the world at large (say in the case of the definition of SMIL) System – used (and found often) on the local system Applications attempting to process an xml document can compare it with the rules and process it only if it is valid

18 © De Montfort University, 200318 Sample dtd #PCDATA – ‘parsed character data’ ie a text node No attributes included Petshow can have one and only 1 child which must be a owner element

19 © De Montfort University, 200319 Occurrence suffixes ? 0 or 1 *0 or more +1 or more x,y,zin this order X|y|zone of these Used to define permissible number of occurrences within DTD

20 © De Montfort University, 200320 Modified DTD showing occurrences

21 © De Montfort University, 200321 Modified DTD showing attributes

22 © De Montfort University, 200322 A look at SMIL


Download ppt "© De Montfort University, 20011 XML – a meta language Howell Istance and Peter Norris School of Computing De Montfort University."

Similar presentations


Ads by Google