Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Basics A brief introduction to XML in general 1XML Basics.

Similar presentations


Presentation on theme: "XML Basics A brief introduction to XML in general 1XML Basics."— Presentation transcript:

1 XML Basics A brief introduction to XML in general 1XML Basics

2 What is XML? XML = eXtensible Markup Language XML vs. HTML – XML was designed to store and transport data – HTML was designed to display data XML is a W3C recommendation, 1998 2XML Basics

3 Use of XML Storage – XML documents can be stored on the hard disk In ordinary files or databases Sending information – XML documents can be send between applications – XML is just text Platform independence Language independence Some XML applications – Web services WSDL: Web Service Description Language SOAP: Simple Object Access Protocol – XHTML HTML described using XML – RSS Really Simple Syndication 3XML Basics

4 XML documents The first line in the document must be the XML declaration – An XML document consists of XML elements – Roskilde – An element has a start tag and an end tag XML elements can have attributes – Attribute values must be quoted ” ….” – … XML elements can contain – Text – Other XML elements Anders Roskilde XML elements can be empty – XML is case-sensitive 4XML Basics

5 XML document, example Anders Roskilde Bill London 5XML Basics

6 Well formed XML documents should be well formed – it must begin with the XML declaration – it must have one unique root element – start-tags must have matching end-tags – elements are case sensitive – all elements must be closed – all elements must be properly nested – all attribute values must be quoted – entities must be used for special characters From http://www.w3schools.com/schema/schema_why.asphttp://www.w3schools.com/schema/schema_why.asp 6XML Basics

7 XML name spaces Name conflict – Different XML document may have elements with the same name Element names can be prefixed to resolve name conflicts – …. In XML a prefix must be declared using a name space – … – Two namespaces, prefix h and f The namespace is an URI – Uniform Resource Identifier – It a unique name. Usually it does NOT lead to a web page! – Default name space (no prefix) … XML Basics7

8 XML support in Microsoft Visual Studio Writing XML documents – Automatic indentation – Marks (red line) if the document is not well formed 8XML Basics

9 XML support in browsers Most modern browsers can show XML documents – Since XML has no appearance, browsers show the document as it is. XML Basics9

10 CSS formatting CSS = Cascading Style Sheets XML documents can be formatted using CSS – http://www.w3schools.com/xml/xml_display.asp Formatting XML with CSS is not the most common method. W3C does NOT recommend using CSS to style XML documents – W3C recommends using XSLT instead. 10XML Basics


Download ppt "XML Basics A brief introduction to XML in general 1XML Basics."

Similar presentations


Ads by Google