XML – 1h
Embed Size (px)
description
Transcript of XML – 1h
-
XML 1h
-
XML: ContentsWhat is XML?What is Well Formed XML?What is Valid XML?Document Type DefinitionsScalable Vector Graphics (SVG)XML in 10 PointsSome Questions for You
-
What is XML?XML is a method of putting structured data in a file format. It is not a programming language; it doesnt DO anything
An XML document includes text and mark-up; just like HTML. XML permits new markup tags to be definedXML is rather more strict than HTML
-
Kilroy was here.
An Easy Example (SVG)
-
What is Well Formed XML?1.Taken as a whole, it matches the production labelled document.2.It meets all the well-formedness constraints given in the W3 specification.3.Each of the parsed entities which is referenced directly or indirectly within the document is well-formed.
I find this a bit vague
-
What is Well Formed XML?There are Elements, Tags and Character Data, eg:
Alan Turing
The whole example was a person Element. Alan Turing was Character Data was a tag
-
What is Well Formed XML?Elements MUST be closedTags may be opening or closing tags of elementsAlternatively, single tags may be closed by a slash, eg
Elements may also be empty
-
What is Well Formed XML?Tags have Names and Attributes (p was a name; font was an attribute)
XML is case sensitive, so the name BR is regarded as different to br
XML must be well nested: Horrors!!!
-
What is Well Formed XML?Names and attributes may contain:
AZ, az or the characters of ANY alphabet (eg: ...)Numbers 09Underscore_ Hyphen- Period.Thats it.
-
What is Well Formed XML?Tags must be closed.Elements may contain elements - nesting must "proper".Tags may contain attributes.Characters such as < and & must be "escaped" as < and & - they have a special significance in XML and may not appear in data unescaped
-
What is Well Formed XML?Must begin with the XML declarationMust have one unique root elementAll start tags must match end-tagsXML tags are case sensitiveAll elements must be closedAll elements must be properly nestedAll attribute values must be quotedXML entities must be used for special characters
-
What is Well Formed XML?Well-formedness is not the same as Validity (see later)
Amazingly strict rule:If a parser encounters a well-formedness violation while parsing a document, it MUST STOP (usually with a useful error message)
-
Pop Quiz5 Minutes Maximum!
-
Pop Quiz
Truth is relative.
Lets vote on the answers.
-
What is Valid XML?If an XML document is well-formed we may ask if it is valid. A valid XML document is one that agrees with the additional rules set out in a DTD (document type definition). The DTD includes: ELEMENT: These dictate what kind of child nodes each element is permitted.ATTLIST: This indicates what kind of attributes are permitted.
-
Scalable Vector Graphics (SVG)(In bit-map graphics we specify the colour of each pixel in a grid). This isnt it.Instead, we describe objects to be rendered. Allows us to produce graphics (boxes, lines, curves, text) in a scalable format. Arbitrarily high resolution with constant file size. Similar to Flash (but Flash has binary format)Designed and controlled by W3C
-
Kilroy was here.
An Easy Example (SVG)
-
Scalable Vector Graphics (SVG)Good example of an XML application. Standard defined by www.w3.org W3C supply a DTD and a description of how each element should be interpretedAnyone can produce a processor for the languageAnyone can produce content.
-
Narrative and Record Documents XML documents normally fall into two categories:An XHTML description of a web page starts at the beginning of the document and works its way down to the endAn XML description of a spreadsheet simply describes the data (there isnt a beginning or an end)
-
Narrative and Record Documents
An XHTML web page is an example of a Narrative document
A spreadsheet in Microsoft Office Open XML (OOXML) is an example of a record document.
-
XML in 10 Points1. XML lets you put structured data in a text file 2. XML looks like HTML but isn't HTML 3. XML is text, but isn't meant to be read 4. XML is a family of technologies 5. XML is verbose, but that is not a problem
-
XML in 10 Points6. XML is new, but not that new 7. XML is license-free8. XML is platform-independent9. XML is well-supported 10. XML is a W3 standard11. For what it does, there are no competitors
-
Recap of UnitWhat is XML?What is Well Formed XML?What is Valid XML?Document Type DefinitionsScalable Vector Graphics (SVG)XML in 10 PointsSome Questions for You