Published on

Tis is a presentation from aeries of slides on the concepts of web, Library Automation for MLIS students

Published in: Technology, News & Politics
  • Be the first to comment


  1. 1. XML Vahideh Z. Gavgani Department of Library & Information Science Osmania University
  2. 2. XML <ul><li>XML stands for Extensible Markup Language. </li></ul><ul><li>Examples of extensible languages are: lisp, forth, XML, and C++. </li></ul>
  3. 3. Introduction <ul><li>The Extensible Markup Language ( XML ) is a general-purpose markup language. It is classified as an extensible language because it allows its users to define their own elements. </li></ul><ul><li>Its primary purpose is to facilitate the sharing of structured data across different information systems, particularly via the Internet. </li></ul><ul><li>It is used both to encode documents and serialize data. </li></ul>
  4. 4. History / Origin XML <ul><li>It started as a simplified subset of the Standard Generalized Markup Language (SGML) , and is designed to be relatively human-legible/readable. </li></ul><ul><li>In 10. February 1998 , XML became a W3C Recommendation. </li></ul>
  5. 5. What is XML? <ul><li>XML stands for E X tensible M arkup L anguage </li></ul><ul><li>XML is a markup language much like HTML </li></ul><ul><li>XML was designed to carry data , not to display data </li></ul><ul><li>XML tags are not predefined. Users must define their own tags </li></ul><ul><li>XML is designed to be self-descriptive </li></ul><ul><li>XML is a W3C Recommendation </li></ul><ul><li>XML is fee-free open standard </li></ul>
  6. 6. Definition <ul><li>a cross-platform, software- and hardware-independent tool for storing and transmitting information. OR simply: </li></ul><ul><li>XML is a software and hardware independent tool for carrying information </li></ul>
  7. 7. The Difference Between XML and HTML <ul><li>XML is not a replacement for HTML. XML and HTML were designed with different goals : </li></ul><ul><li>XML was designed to transport and store data , with focus on what data is . HTML was designed to display data , with focus on how data looks . </li></ul><ul><li>HTML is about displaying information , while XML is about carrying information . </li></ul>
  8. 8. An example of XML document <ul><li>Maybe it is a little hard to understand, but XML does not DO anything. XML was created to structure, store, and transport information. </li></ul><ul><li>The following example is a note to Tove from Jani, stored as XML: </li></ul><note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
  9. 9. XML Files in browsers <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?> </li></ul><ul><li>  - < note > </li></ul><ul><li>        < to > Tove < to > </li></ul><ul><li>        < from > Jani < from > </li></ul><ul><li>       < heading > Reminder < heading > </li></ul><ul><li>  < body > Don't forget me this weekend! < body >     </li></ul><ul><li>< note > </li></ul>The XML document will be displayed with color-coded root and child elements. A plus (+) or minus sign (-) to the left of the elements can be clicked to expand or collapse the element structure.
  10. 10. What it means? <ul><li>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). </li></ul><ul><li>The next line describes the root element of the document (like saying: &quot;this document is a note&quot;): </li></ul><ul><li>The next 4 lines describe 4 child elements of the root (to, from, heading, and body): </li></ul><ul><li>And finally the last line defines the end of the root element: </li></ul>
  11. 11. Why Does XML Display Like This? <ul><li>XML documents do not carry information about how to display the data. </li></ul><ul><li>Since XML tags are &quot;invented&quot; by the author of the XML document, browsers do not know if a tag like <table> describes an HTML table or a dining table. </li></ul><ul><li>Without any information about how to display the data, most browsers will just display the XML document as it is. </li></ul><ul><li>Raw XML files can be viewed in all major browsers. </li></ul><ul><li>Don't expect XML files to be displayed as HTML pages. </li></ul>
  12. 12. XML Documents Form a Tree Structure <ul><li>XML documents must contain a root element . This element is &quot;the parent&quot; of all other elements. </li></ul><ul><li>The elements in an XML document form a document tree. </li></ul><ul><li>The tree starts at the root and branches to the lowest level of the tree. </li></ul><ul><li>All elements can have sub elements (child elements): </li></ul>
  13. 13. Parent-child relationship <ul><li><root> </li></ul><ul><li><child> </li></ul><ul><li><subchild>.....</subchild> </li></ul><ul><li></child> </li></ul><ul><li></root> </li></ul>The terms parent, child, and sibling are used to describe the relationships between elements. Parent elements have children. Children on the same level are called siblings (brothers or sisters).All elements can have text content and attributes (just like in HTML).
  14. 14. An Example representing one book in the XML tree :
  15. 15. Bookstore in XML
  16. 16. XML is self-described <ul><li>The tags in the example above (like <to> and <from>) are not defined in any XML standard. These tags are &quot;invented&quot; by the author of the XML document. </li></ul><ul><li>That is because the XML language has no predefined tags. </li></ul><ul><li>The tags used in HTML (and the structure of HTML) are predefined. HTML documents can only use tags defined in the HTML standard (like <p>, <h1>, etc.). </li></ul><ul><li>XML allows the author to define his own tags and his own document structure </li></ul>
  17. 17. How to use XML XML Separates Data from HTML <ul><li>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. </li></ul><ul><li>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. </li></ul><ul><li>With a few lines of JavaScript, you can read an external XML file and update the data content of your HTML. </li></ul>
  18. 18. XML Simplifies Platform Changes <ul><li>Upgrading to new systems (hardware or software platforms), is always very time consuming. Large amounts of data must be converted and incompatible data is often lost. </li></ul><ul><li>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. </li></ul>
  19. 19. XML Makes Your Data More Available <ul><li>Since XML is independent of hardware, software and application, XML can make your data more available and useful. </li></ul><ul><li>Different applications can access your data, not only in HTML pages, but also from XML data sources. </li></ul><ul><li>With XML, your data can be available to all kinds of &quot;reading machines&quot; (Handheld computers, voice machines, news feeds, etc), and make it more available for blind people, or people with other disabilities. </li></ul>
  20. 20. XML is Used to Create New Internet Languages <ul><li>Since XML is independent of hardware, software A lot of new Internet languages are created with XML. Here are some examples: </li></ul><ul><li>XHTML the latest version of HTML  </li></ul><ul><li>WSDL for describing available web services </li></ul><ul><li>WAP and WML as markup languages for handheld devices </li></ul><ul><li>RSS languages for news feeds </li></ul><ul><li>RDF and OWL for describing resources and ontology </li></ul><ul><li>SMIL for describing multimedia for the web </li></ul>
  21. 21. XML Tags are Case Sensitive <ul><li>XML elements are defined using XML tags. </li></ul><ul><li>XML tags are case sensitive. With XML, the tag <Letter> is different from the tag <letter>. </li></ul><ul><li>Opening and closing tags must be written with the same case: </li></ul><ul><li>Note: &quot;Opening and closing tags&quot; are often referred to as &quot;Start and end tags&quot;. Use whatever you prefer. It is exactly the same thing. </li></ul><Message> This is incorrect </message>   <message> This is correct </message>
  22. 22. XML Elements Must be Properly Nested <ul><li>In HTML, you will often see improperly nested elements: </li></ul><ul><li><b><i>This text is bold and italic</b></i> </li></ul><ul><li>In XML, all elements must be properly nested within each other: </li></ul><ul><li><b><i>This text is bold and italic</i></b> </li></ul><ul><li>In the example above, &quot;Properly nested&quot; simply means that since the <i> element is opened inside the <b> element, it must be closed inside the <b> element. </li></ul>
  23. 23. XML Attribute Values Must be Quoted <ul><li>XML elements can have attributes in name/value pairs just like in HTML. </li></ul><ul><li>In XML the attribute value must always be quoted. Study the two XML documents below. The first one is incorrect, the second is correct: </li></ul>The error in the first document is that the date attribute in the note element is not quoted <note date=12/11/2007> <to>Tove</to> <from>Jani</from> </note> <note date=&quot;12/11/2007&quot;> <to>Tove</to> <from>Jani</from> </note>
  24. 24. Advantages of XML <ul><li>It is text-based . </li></ul><ul><li>It supports Unicode , allowing almost any information in any written human language to be communicated. </li></ul><ul><li>It can represent common computer science data structures: records, lists and trees </li></ul><ul><li>XML is heavily used as a format for document storage and processing, both online and offline. </li></ul><ul><li>It is based on international standards . </li></ul><ul><li>The hierarchical structure is suitable for most (but not all) types of documents. </li></ul><ul><li>It manifests as plain text files, which are less restrictive than other spesific/proprietary document formats. </li></ul><ul><li>It is platform-independent , thus relatively immune to changes in technology. </li></ul>
  25. 25. Disadvantages of XML <ul><li>XML syntax is redundant or large relative to binary representations of similar data. </li></ul><ul><li>The redundancy may affect application efficiency through higher storage, transmission and processing costs . </li></ul><ul><li>XML syntax is verbose , especially for human readers, relative to other alternative 'text-based' data transmission formats. </li></ul><ul><li>The distinction between content and attributes in XML seems unnatural to some and makes designing XML data structures harder. </li></ul><ul><li>Linking between XML documents requires the use of XLink , which is complex compared to hyperlinks </li></ul><ul><li>It's hard to find an XML parser that is complete, correct, and efficient </li></ul>
  26. 26. Parsing <ul><li>Parsing ( Parser= to analyze) </li></ul><ul><li>In computer science , lexical analysis is the process of converting a sequence of characters into a sequence of tokens </li></ul><ul><li>In computer science and linguistics, parsing (more formally : syntactic analysis ) is the process of analyzing a sequence of tokens to determine its grammatical structure with respect to a given formal grammar . A parser is the component of a compiler that carries out this task. </li></ul>
  27. 27. Token ;block of data ADD_OP + NUMBER 3 ASSIGN_OP = IDENT sum token type lexeme
  28. 28. Unicode <ul><li>In computing, Unicode is an industry standard allowing computers to consistently represent and manipulate text expressed in most of the world's writing systems. </li></ul><ul><li>Originaly it appeared to solve the nefficiency of already existed encoding sysytem approved by ISO 8859 which allowed romance based writing systems transfer and diplayed in computer. So other languages’ wriing system such as Arabic or Hebrew, and left-to-right scripts faced with incounsistency and incompatibility proble. Unicode using Unicode Transformation format UTF schem erised to allow multilingual characters transform, and munipoulated in various systems </li></ul>
  29. 29. Serialization <ul><li>In computer science, in the context of data storage and transmission, serialization is the process of saving an object onto a storage medium (such as a file, or a memory buffer) or to transmit it across a network connection link in binary form. The series of bytes or the format can be used to re-create an object that is identical in its internal state to the original object (actually, a clone). </li></ul><ul><li>This process of serializing an object is also called deflating or marshalling an object. The opposite operation, extracting a data structure from a series of bytes, is deserialization (which is also called inflating or unmarshalling ). </li></ul>