Introduction to XML This is not an XML

  • Slides: 9
Download presentation

Introduction to XML This is not an XML class, but for those who do

Introduction to XML This is not an XML class, but for those who do not know XML, here is a very brief introduction…

What is XML? • XML is a standard published by the W 3 C

What is XML? • XML is a standard published by the W 3 C • It is used to describe markup languages (“tag sets”) • It is application- and platform-independent • It handles multiple character sets (unicode) • It is a text format which is easy to read

How Does XML Work? • XML takes a stream of text characters, and allows

How Does XML Work? • XML takes a stream of text characters, and allows them to be interpreted as a tree structure – It combines the properties of documents with the structure of object-oriented systems

Text Text = XML “element” Text = string, code, or number Text

Text Text = XML “element” Text = string, code, or number Text

XML Elements • XML elements have names, and a specific content which is described

XML Elements • XML elements have names, and a specific content which is described either in a DTD or (as for SDMXML) in an XML schema • XML elements can contain other elements, or values, or both (or neither) • They have a start tag <Name. Of. Element> and an end tag </Name. Of. Element> • They can have additional properties, called attributes: <Name. Of. Element Name. Of. Attribute=“Value. Of. Attribute”>

XML Elements (cont. ) • In an XML document, everything between an element’s start

XML Elements (cont. ) • In an XML document, everything between an element’s start tag and end tag is contained in that element: <Elem. A> <Elem. B>Some Text</Elem. B> <Elem. C>Some Other Text</Elem. C> </Elem. A> • Here, Elem. A contains Elem. B and Elem. C, which in turn contain text.

XML Documents • XML documents have their exact contents (elements, attributes, numeric, string, and

XML Documents • XML documents have their exact contents (elements, attributes, numeric, string, and coded data) described in a separate XML file called an XML Schema • XML documents can be validated with a generic processor called an “XML Parser” • XML documents can be rendered into tree objects in memory, for processing, by many different software tools

Why XML is so Popular • XML is popular because: – it allows very

Why XML is so Popular • XML is popular because: – it allows very complex sets of structured data to be transmitted over the internet as a simple stream of characters (a document), but… – It allows processing of that simple stream as a rich object model in the receiving application • XML is ubiquitous on the Internet, and is the basis of all web-services applications