3-Introduction to XML

3-Introduction to XML - COMP 2405 Imran Ahmad

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 2405 Imran Ahmad
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
XML stands for eXtensible Markup Language XML is a markup language much like HTML that is  used to describe data XML tags are not predefined - you must define  your own tags XML uses a Document Type Definition (DTD) or  an XML Schema to describe the data XML with a DTD or XML Schema is designed to  be self-descriptive
Background image of page 2
XML was designed to carry data HTML and XML were designed with different goals HTML is about displaying information, while XML  is about describing information
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
<?xml version=“1.0” encoding=“ISO-8859-1”?>  <note> <to> Tom </to>    <from> Jane </from>    <heading> Reminder </heading>    <body> Meeting </body> </note> The XML example was created to structure and  store information. It does not DO anything  because someone must write programs to send,  receive or display it.
Background image of page 4
New tags and the corresponding document  structure are “invented” in our example
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
XML separates Data from HTML Data can be exchanged between incompatible  systems With XML, plain text files can be used to share  data XML can also be used to create new languages,  such as the Wireless Markup Language (WML)
Background image of page 6
<?xml version=“1.0” encoding=“ISO-8859-1”?>  <note> <to> Tom </to>    <from> Jane </from>    <heading> Reminder </heading>    <body> Meeting </body> </note> The first line in the document – the XML  declaration – defines the XML version and  character encoding used in the document
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
In the example, the document conforms to the 1.0  specification of XML and uses the ISO-8859-1  (Latin-1/West European) character set The next line describes the root element of the  document <note> The next 4 lines describe 4 child elements of the  root: <to>, <from>, <heading> and <body> And finally the last line ends the root element  </note>
Background image of page 8
All XML elements must have a closing tag In HTML, some elements do not have to have a  closing tag, for example: <p> This is a paragraph XML tags are case sensitive, whereas HTML tags  are case insensitive All XML elements must be properly nested and  improper nesting of tags makes no sense to XML. <b><i>This is bold and italic</b></i>  - Incorrect <b><i>This is bold and italic</i></b>  - Correct
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
All XML documents must have a root element All other elements are within this root element All elements can have sub elements (child  elements) that are properly nested within their  parent element: <root> <child> <subchild>….</subchild> </child> </root>
Background image of page 10
XML elements can have attributes in name/value  pairs The attribute value must always be quoted <?xml version=“1.0” encoding=“ISO-8859-1”?> <note date=“6/1/2004”> <to>Tom</to> </note>
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 41

3-Introduction to XML - COMP 2405 Imran Ahmad

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online