Lect7-8 - XML
Lect7-8 - XML
CSI-654
(XML)
XML
Introduction
A markup language much like HTML
A simple text based format for representing structured information, documents, data,
configuration, books, transactions, invoices etc.
It was designed to carry data, not to display data
Designed to transport and store data, with focus on what data is………
The tags are not predefined. One must define their own tags
It is a software- and hardware-independent tool for carrying information
It is the set of rules for encoding documents in machine readable form. It is defined in
the XML 1.0 specification produced by the world wide consortium (W3C)
A tool for data transmissions between all sorts of applications
It is designed to be self-descriptive
It is a (W3C) recommendation
It is not a replacement for HTML
As of 2009, hundreds of XML based languages have been developed including
RSS (Really Simple Syndication), Atom, SOAP(Simple Object Access Protocol ) and
XHTML
Why study XML?
Entity References
Some characters have a special meaning in XML, like "<" inside an XML element, it will
generate an error because the parser interprets it as the start of a new element.
To avoid this error, replace the "<" character with an entity reference
<message>if salary < 1000 then</message>
There are 5 predefined entity references in XML < < less than
Only the characters "<" and "&" are strictly illegal in XML
> > greater than
& & ampersand
' ' apostrophe
" " quotation mark
Comments
<!-- This is a comment -->
XML Stores New Line as LF
<person>
<name>
<firstname>Ahmed</firstname>
<lastname>Ali</lastname>
</name>
<job>Engineer</job>
<gender>Male</gender>
</person>
One.xml
XML
person
<?xml version="1.0"?> {
<?xml-stylesheet type="text/css“ background-color:#ccff00;
href=“myone.css"?> font-family:century gothic,arial,sans-serif;
<person> }
<name> job
<firstname>Ahmed</firstname> {
<lastname>Ali</lastname> display:block;
</name> font-family:arial
}
<job>Engineer</job>
gender
<gender>Male</gender> {
</person> font-family:arial black;color:red;
One.xml myone.css
Advantages of using XML
• Simpler version of Standard Generalized Markup Language (SGML).
• Easy to understand and read.
• Supported by a large number of platforms.
• Used across open standards.
THE END