Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML eXtensible Markup Language. Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB.

Similar presentations


Presentation on theme: "XML eXtensible Markup Language. Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB."— Presentation transcript:

1 XML eXtensible Markup Language

2 Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB 124 Web Programming

3 What is XML  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data  XML tags are not predefined. You must define your own tags  XML is designed to be self-descriptive  XML is a W3C Recommendation CSEB 124 Web Programming

4 Difference between XML and HTML  XML was designed to carry data, not displaying data  XML is not a replacement for HTML.  Different goals: -XML was designed to describe data and to focus on what data is. -HTML was designed to display data and to focus on how data looks.  HTML is about displaying information, XML is about describing information. CSEB 124 Web Programming

5 How XML Can Be Used?  Plain Text -Easy to edit -Useful for storing small (compared to large databases) amounts of data -Possible to efficiently store large amounts of XML data through an XML front end to a database (Don’t believe it)  Data Identification -Tell you what kind of data you have -Can be used in different ways by different applications CSEB 124 Web Programming

6 How XML Can Be Used?  Stylability -Inherently style-free -XSL---Extensible Stylesheet Language -Different XSL formats can then be used to display the same data in different ways  Easily Processed -Regular and consistent notation -Vendor-neutral standard  Hierarchical -Fast to access -Easy to rearrange CSEB 124 Web Programming

7 How XML Can Be Used?  XML Separates Data from HTML  If you need to display dynamic data in your HTML document, it will take a lot of work to edit the HTML each time the data changes.  With XML, data can be stored in separate XML files. This way you can concentrate on using HTML for layout and display, and be sure that changes in the underlying data will not require any changes to the HTML.  With a few lines of JavaScript code, you can read an external XML file and update the data content of your web page. CSEB 124 Web Programming

8 How XML Can Be Used?  XML Simplifies Data Sharing  In the real world, computer systems and databases contain data in incompatible formats.  XML data is stored in plain text format. This provides a software- and hardware-independent way of storing data.  This makes it much easier to create data that can be shared by different applications. CSEB 124 Web Programming

9 How XML Can Be Used?  XML Simplifies Data Transport  One of the most time-consuming challenges for developers is to exchange data between incompatible systems over the Internet.  Exchanging data as XML greatly reduces this complexity, since the data can be read by different incompatible applications. CSEB 124 Web Programming

10 How XML Can Be Used?  XML Simplifies Platform Changes  Upgrading to new systems (hardware or software platforms), is always time consuming. Large amounts of data must be converted and incompatible data is often lost.  XML data is stored in text format. This makes it easier to expand or upgrade to new operating systems, new applications, or new browsers, without losing data. CSEB 124 Web Programming

11 How XML Can Be Used?  XML Makes Your Data More Available  Different applications can access your data, not only in HTML pages, but also from XML data sources.  With XML, your data can be available to all kinds of "reading machines" (Handheld computers, voice machines, news feeds, etc), and make it more available for blind people, or people with other disabilities. CSEB 124 Web Programming

12 How XML Can Be Used?  XML is Used to Create New Internet Languages  A lot of new Internet languages are created with XML.  Here are some examples: -XHTML -WSDL for describing available web services -WAP and WML as markup languages for handheld devices -RSS languages for news feeds -RDF and OWL for describing resources and ontology -SMIL for describing multimedia for the web CSEB 124 Web Programming

13 An example of XML Tove Jani Reminder Don't forget me this weekend! CSEB 124 Web Programming

14 An example of XML  The tags in the example above (like and ) are not defined in any XML standard. These tags are "invented" by the author of the XML document.  That is because the XML language has no predefined tags.  The tags used in HTML are predefined. HTML documents can only use tags defined in the HTML standard (like,, etc.).  XML allows the author to define his/her own tags and his/her own document structure. CSEB 124 Web Programming

15 XML BUILDING BLOCKS  Element -Delimited by angle brackets -Identify the nature of the content they surround -General format: … -Empty element:  Attribute -Example: - has an attribute (category="COOKING"). CSEB 124 Web Programming

16 XML Syntax  Refer to slide 13. The first line is the XML declaration. It defines the XML version (1.0) and the encoding used (ISO-8859-1 = Latin-1/West European character set).  Comments in XML:  XML tags are case sensitive  All XML elements must have a closing tag WRONG This is a paragraph This is another paragraph CORRECT This is a paragraph This is another paragraph CSEB 124 Web Programming

17 XML Syntax  All XML elements must be properly nested WRONG This text is bold and italic CORRECT This text is bold and italic  All XML documents must have a root tag..... CSEB 124 Web Programming

18 XML Syntax  Attribute values must always be quoted CORRECT Tove Jani OR Tove Jani  With XML, white space is preserved Unlike XML, HTML truncates multiple white-space characters to one single white-space. ExampleHTML: Hello Tove Output: Hello Tove With XML, the white-space in a document is not truncated. CSEB 124 Web Programming

19 XML Naming Rules  Names can contain letters, numbers, and other characters  Names cannot start with a number or punctuation character  Names cannot start with the letters xml (or XML, or Xml, etc)  Names cannot contain spaces CSEB 124 Web Programming

20 Most Recommended way  A date attribute is used in the first example: Tove Jani Reminder Don't forget me this weekend! CSEB 124 Web Programming

21 Most Recommended way  A date element is used in the second example: 10/01/2008 Tove Jani Reminder Don't forget me this weekend! CSEB 124 Web Programming

22 Most Recommended way  The most recommended way: an expanded date element is used. 10 01 2008 Tove Jani Reminder Don't forget me this weekend! CSEB 124 Web Programming

23 Viewing XML Files  Viewing XML Files Viewing XML Files -XML documents do not carry information about how to display the data. -Without any information about how to display the data, most browsers will just display the XML document as it is.  Viewing an Invalid XML File Viewing an Invalid XML File  Other XML Examples Other XML Examples CSEB 124 Web Programming

24 Viewing XML Files  Displaying XML with CSS Displaying XML with CSS  XSLT is the recommended style sheet language of XML.  XSLT (eXtensible Stylesheet Language Transformations) is far more sophisticated than CSS.  XSLT can be used to transform XML into HTML, before it is displayed by a browser:  Displaying XML with XSLT Displaying XML with XSLT CSEB 124 Web Programming

25 Viewing XML Files  For more detail: http://www.w3schools.com/xml/xml_display.asp  Refer to the next slide, where link to the XML applications is shown. CSEB 124 Web Programming

26 XML Applications DEMO: http://www.w3schools.com/xml/xml_applications.asp CSEB 124 Web Programming

27 REFERENCES  W3Schools (http://www.w3schools.com/xml/default.asp)http://www.w3schools.com/xml/default.asp  XML material of HELINKS Substation Tool Set Training CSEB 124 Web Programming


Download ppt "XML eXtensible Markup Language. Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB."

Similar presentations


Ads by Google