Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 13 XML and its applications. Definition Extensible Markup Language, abbreviated XML, describes a class of data objects called XML documents and.

Similar presentations


Presentation on theme: "Lecture 13 XML and its applications. Definition Extensible Markup Language, abbreviated XML, describes a class of data objects called XML documents and."— Presentation transcript:

1 Lecture 13 XML and its applications

2 Definition Extensible Markup Language, abbreviated XML, describes a class of data objects called XML documents and partially describes the behavior of computer programs which process them. XML is an application profile or restricted form of SGML, the Standard Generalized Markup Language [ISO 8879]. By construction, XML documents are conforming SGML documents.XML documents [ISO 8879]. Extensible Markup Language (XML) 1.0 (Third Edition) W3C Recommendation 04 February 2004

3 So what is it really? A document syntax (markup) standard for text documents that is simple and open (non-proprietary) for electronic data exchange and storage. It is flexible and eXtendable (Xml) because it allows users to create their own vocabularies (new markup languages) - no fixed set of tags as in HTML or XHTML. XML documents contain only data delimited by tags – no formatting instructions or style. Arguably the most important document syntax standard in the history of computing – “the ASCII of the Internet Age”.

4 A little history Developed by an XML Working Group formed under the auspices of the World Wide Web Consortium (W3C) in 1996.World Wide Web Consortium (W3C) A subset of SGML (Standard Generalized Markup Language) originally designed to meet the challenges of large-scale electronic publishing. XML now adopted in fields as diverse as law, healthcare, insurance, multimedia, web publishing, EDI, telecommunications, aeronautics, engineering, software, hospitality, tourism, retail, stock trading, etc. etc. etc. ………

5 Design goals The original design goals for XML were: - that it should be straightforwardly usable over the Internet. - that it should support a wide variety of applications. - that it be compatible with SGML. - that it should be easy to write programs which process XML documents. - that the number of optional features in XML were to be kept to the absolute minimum, ideally zero. - that XML documents should be human-legible and reasonably clear. - that the XML design would be prepared quickly. - that the design of XML would be formal and concise. - that XML documents would be easy to create. - that terseness in XML markup was to be of minimal importance.

6 Example XML document Joseph Michael Bloggs Joe Mr 2 Gloucester Road Bristol Avon BS2 4QS 0117 9541054 07710 234674 joe.bloggs@email.com

7 pipe dilimited nhs-no|first|middle|last|previous|preferred|………………. |email|fax 7503557856|Joseph|Michael|Bloggs|||Joe|………………….|joe.bloggs@email.com| Other formats relational table Patient nhs-no 7503557856 first Joseph middleMichael

8 a simple element containing text attribute; attributes provide additional information about an element and consist of a name value pair; the value must be enclosed in a single (‘) or double quote (“) Example XML document deconstructed Joseph Michael Bloggs Joe Mr 2 Gloucester Road Bristol Avon BS2 4QS 0117 9541054 07710 234674 joe.bloggs@email.com xml declaration (optional) used by xml processor; this documents conforms to xml version 1 and uses the UTF-8 standard (Unicode optimized for ASCII) root element; every well formed xml document must be enclosed by exactly one root element. empty elements a complex element containing other elements and text a comment; comments must be delimited by the characters as in xhtml

9 Tree view of example XML document (all xml documents are hierarchical in structure) patient name title address fax tel first middle last previous preferred street1 street2 street3 city county postcode home mobile JosephMichaelBloggs Joe 2 Gloucester Rd BristolAvon BS2 4QS 01179541054 07710234674 Mr nhs-no 7503557856 KEY element content attribute

10 Well-formed XML documents (1) Every XML document must be well-formed and must therefore adhere to the following rules (among others): 1.Every start-tag must have a matching end tag. 2.Elements may nest but must not overlap. Anna Coffey - √ Anna Coffey - × 3.There must be exactly one root element. 4.Attribute values must be quoted. 5.An element must not be quoted. 6.Comments and processing instructions may not appear inside tags. 7.No unescaped < or & signs may occur in the character data of an element. Note: A XML document may be well-formed but not valid. A valid document requires a declaration that identifies a Document Type Definition (DTD) or Schema that the document conforms to. This ensures that the document meets various grammar rules for each of its elements and attributes, their order and the values that are allowed. A validating parser can check the document to ensure these rules are met. We will look at XML Schemas in some detail in the next lecture.

11 Well-formed XML documents (2) Element names are case sensitive -,, & are four different element types. No white spaces in element name - not allowed; OK. Element names cannot start with the letters “XML” or “xml” – reserved terms. Element names must start with a letter or a underscore. Element names cannot start with a number but numbers may be embedded within an element name - not allowed; is OK. Attribute names are constrained by the above rules for element names. Entity references are used to substitute specific characters. There are five predefined entities built into XML: EntityCharNotes &&Do not use inside processing instructions <<Use inside attribute values quoted with “. >>Use after ]] in normal text and inside processing instruction. "“Use inside attribute values quoted with “. &apos; ‘Use inside attribute values quoted with ‘.

12 XML Namespaces Namespaces serve two functions in the XML specification: 1.To distinguish between elements and attributes from two different vocabularies with different meanings that might share the same name and hence avoid naming collisions. 2.To group all the related attributes from a single XML application together so that software can easily recognise them. Consider the following fragments from two different documents: Bernadette Coffey and Hegel in a Nutshell The first element refers to the name of a person and the second to the name of a book. If we were to build a merged document (say Bernadette’s reading list) we will have a collision since there are two elements with different meanings. Namespaces can distinguish between the two by using prefixes. Bernadette Coffey and Hegel in a Nutshell Each element has a prefix corresponding to a uniform resource identifier (URI) that uniquely identifies the namespace e.g. and BUT – don’t confuse URI’s with URL’s. URL’s are a subset of URI’s that locate resources based on a network filename concept. A URL is a path to a file or resource on the Web. A URI used as a namespace is simply a unique name.

13 XML Applications (1) XSLTXSLT – Extensible Stylesheet Language Transformations is an application for specifying rules which transform one XML document into another document. It uses template rules in the stylesheet to match patterns in the input document and when a match is found it writes the template from the rule to the output tree. We will look at XSLT in detail in Lecture15.

14 XML Applications (2) XLinksXLinks - is the XML Linking Language. It defines how one document links to another. It is divided into two parts XLinks and XPointer (which identifies a particular part of the document (re: anchors in HTML)). XPathXPath – XPath is a non-XML language for identifying particular parts of an XML document. It is designed to be used in conjunction with the Extensible Stylesheet Language Transformations (XSLT) and XPointer. XFormsXForms – is the W3C’s name for a specification of Web forms that can be used with a wide variety of platforms including desktop computers, hand helds, information appliances and even paper. XQueryXQuery – an XML based query language to extract data from real or virtual documents providing the needed interaction between the Web and databases. SVGSVG – Scalable Vector Graphics. A XML application which describes vector graphics data for JPEG, GIF and PNG for distribution and display over the web. Other applications (and the list is growing rapidly) include – XML Signature, XML Encryption, Web Services (SOAP, WDSL & UDDI), XML Key Management, Synchronized Multimedia Integration Language (SMIL), etc. etc. etc.XML Signature XML EncryptionWeb Services XML Key ManagementSynchronized Multimedia Integration Language

15 XML Vocabularies XHTMLXHTML – the Extensible HyperText Markup Language which reproduces and extends HTML. An XHTML document conforms to all rules required of a well formed XML document and drops many of the weak features of HTML e.g. the tag. WMLWML – the Wireless Markup Language is a strict HTML type vocabulary for use with wireless-enabled devices such as mobile phones, PDA’s & pagers. InkMLInkML – For representing digital ink data that is input with a pen. MathMLMathML – For the inclusion of mathematical formulas in web pages and machine to machine communications. CMLCML – Chemical Markup Language is a XML vocabulary for representing molecular and chemical information. A formula can be transformed into a graphic represenation for displaying on a web page. Others standardized vocabularies include the Banking Industry Technology Secretariat (BITS); Financial Exchange (IFX); Bank Internet Payment System (BIPS); Telecommunications Interchange Markup (TIM); Common Business Library (xCBL); Electronic Business XML Initiative (ebXML); Product Data Markup Language (PDML); Financial Information eXchange protocol (FIX); The Text Encoding Initiative (TEI) and hundreds of others.

16 Resources


Download ppt "Lecture 13 XML and its applications. Definition Extensible Markup Language, abbreviated XML, describes a class of data objects called XML documents and."

Similar presentations


Ads by Google