Introduction to XML This presentation is done by
Introduction to XML This presentation is done by Raghul, Puvanesh, Nikilla, Janaki
Outline What is XML? Syntax of XML Document DTD (Document Type Definition) XHTML
Introduction to XML stands for EXtensible Markup Language XML was designed to describe data. XML tags are not predefined unlike HTML XML DTD and XML Schema define rules to describe data XML example of semi structured data
Building Blocks of XML Elements (Tags) are the primary components of XML documents. Element FNAME nested inside <AUTHOR id = 123> element Author. Element <FNAME> JAMES</FNAME> Author with <LNAME> RUSSEL</LNAME> Attr id </AUTHOR> <!- I am comment -> Attributes provide additional information about Elements. Values of the Attributes are set inside the Elements Comments stats with <!- and end with ->
XML DTD A DTD is a set of rules that allow us to specify our own set of elements and attributes. DTD is grammar to indicate what tags are legal in XML documents. c XML Document is valid if it has an attached DTD and document is structured according to rules defined in DTD.
DTD Example <BOOKLIST> <BOOK GENRE = “Science” FORMAT = “Hardcover”> <AUTHOR> <FIRSTNAME> RICHRD </FIRSTNAME> <LASTNAME> KARTER </LASTNAME> </AUTHOR> </BOOKS> Xml Document And Corresponding DTD <!DOCTYPE BOOKLIST[ <!ELEMENT BOOKLIST(BOOK)*> <!ELEMENT BOOK(AUTHOR)> <!ELEMENT AUTHOR(FIRSTNAME, LASTNAM E)> <!ELEMENT FIRSTNAME(#PCDATA)> <!ELEMENT>LASTNAME(#PCDATA) > <!ATTLIST BOOK GENRE (Science|Fiction)#REQUIRED> <!ATTLIST BOOK FORMAT (Paperback|Hardcover) “Paper. Back”>]>
HTML TO XHTML? ? ? HTML was originally a SGML application Tags described the syntax A DTD could check the syntax Informal mapping from syntax to rendering Useful for future development
XHTML Basic Very few real changes from HTML But more strict All tags are in lowercase All tags must be closed
Structure of XHTML 3 Parts to an XHTML or HTML document DOCTYPE HEAD BODY
Example link for XHTML An example for an xml website is given below Click here for sample XHTML page
- Slides: 10