1 / 20

XML Extensible Markup Language

XML Extensible Markup Language. By: Gaurav Poudyal. Overview. XML Different XML Related Technologies XHTML XForms XQuery Conclusion. What is XML?. Markup language very similar to HTML How do they differ? HTML focuses on displaying data XML focuses on describing the data

violet
Download Presentation

XML Extensible Markup Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XMLExtensible Markup Language By: Gaurav Poudyal

  2. Overview • XML • Different XML Related Technologies • XHTML • XForms • XQuery • Conclusion

  3. What is XML? • Markup language very similar to HTML • How do they differ? • HTML focuses on displaying data • XML focuses on describing the data • XML tags are not predefined as in HTML

  4. Example Code • XML structures information • Code below is just information stored in XML tags <?xml version="1.0" encoding=""?> <journal> <message>Today is Wednesday and it’s windy.</message><br /> <message1>It is snowing outside</message1><br /> </journal>

  5. XML • XML requires syntax just as in HTML 1) <?xml version="1.0" encoding=""?> 2) <journal> 3) <message>Today is Wednesday and it’s windy.</message> 4) <message1>It is snowing outside</message1> 5) </journal> • First line states XML version and the encoding • Tag journal is the root element • Lines 3 and 4 are child elements

  6. XML • All tags must have a closing tag, unlike in HTML • XML tags are case sensitive • XML preserves the white space, unlike HTML Code: Today is Wednesday Displayed in html: Today is Wednesday Displayed in XML: Today is Wednesday

  7. XML Elements • Elements can have relationships <class> <title>My Classes</title> <course>463</course> <subject>Client Server Web Applications <para>What is HTML</para> <para>What is XML</para> </subject> </class> • In the code above, class is the root element • Title, course, subject are child elements of class • Class is the parent element of title, course, subject • Title, course, subject are sister elements

  8. XML with ASP • XML can be generated on server with ASP <% response.ContentType="text/xml" response.Write("<?xml version='1.0' encoding='ISO-8859-1'?>") response.Write("<class>") response.Write("<title>My Classes</title>") response.Write("<course>Coms 463</course>") response.Write("<subject>Client Server Web Applications</subject>") response.Write("<para>What is HTML</para>") response.Write("<para>What is XML</para>") response.Write("</class>") %> • Must be saved as a .asp file

  9. XML Related Technologies Few that I am covering in this presentation • XHTML • XForms • XQuery

  10. XHTML • XHTML is also known as Extensible Hypertext Markup Language • XHTML is similar to HTML with stricter rules • XHTML needs proper syntax and formats • Nested elements • Proper tag names • Closed tag elements • Quoted and lowercase attribute names

  11. Code Example Properly nested code: <ul> <li>Book</li> <li>Article <ul> <li>Online Article</li> </ul> </li> <li>Print</li> </ul>

  12. Code Example Proper tag names: • Tags should be all lowercase • Cannot be <email> and <Email> • Cannot be <body> and <BODY> • All tags must be closed at end <email> <body>How are you?</body> </email>

  13. Code Example Lower case attribute names and quoted value • Attribute name “width” must be lowercase • Value must be quoted, either single or double quotes <table width = "50%">

  14. XForms • XForms are also known as XML Forms • More affluent • More flexible

  15. Code Example <xforms> <model> <instance> <course> <cname/> <cid/> </course> </instance> <submission id="form1" method="get" action="submit.asp"/> </model> <input ref="cname"> <label>Course Name</label></input><br /> <input ref="cid"> <label>Course Iden</label></input><br /><br /> <submit submission="form1"> <label>Submit</label></submit> </xforms> • XML is used in XForm to define the form data • XML is also used to store and transport the data • Model defines the data • Instance defines the data that will be collected. These data will be stored in XML tags and transported to the destination provided • Submission defines how the data will be submitted • Rest of code for user interface

  16. Control Elements • Input • Output • Submit • Secret • Select1 • Select • Upload and more…

  17. XQuery • XQuery is also known as XML Query Language • Way to query XML data • Supported by all databases • Find information, build reports and search web documents

  18. Code Example • Function extracts data from file; doc(“classes.xml”) • Path expressions; doc(“classes.xml”)/classes/class/title • Predicates; doc(“classes.xml”)/classes/class[maxstudents>20] (classes.xml) <?xml version="1.0" encoding="ISO-8859-1"?> <classes> <class category="Computers"> <title lang="en">Client Server</title> <teacher>Dr. Syed</teacher> <term>Fall 2005</term> <maxstudents>20</maxstudents> </class> <class category="Business"> <title lang="en">International Business</title> <teacher>John Doe</teacher> <term>Fall 2005</term> <maxstudents>50</maxstudents> </class> </classes>

  19. XQuery • Syntax rules should be followed in XQuery • All elements, variable, attributes must be valid XML names • String value must be in quotes • Conditional statements can be used, such as if-then-else

  20. The EndThanks!

More Related