VISION ACADEMY (BCA,BBA(CA),BCS,MCA)
XML
With Teacher
Sachin Zurange
W HA T IS
• XML standsX
for M L?
Extensible Markup Language
• XML is a markup language much like HTML
•XML is text-based markup language that enables to
store data
in structure format by using meaningful tags.
•XML tags are not predefined. You must define your
own tags
• XML is designed to be self-descriptive
•XML is a W3C (World Wide Web Consortium
Recommendation
Feature of X M L
1.XML Separates Data from HTML 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.
With XML, data can be stored in separate X M L files.
This way you can concentrate on using HTML/CSS f or display and layout, and be
sure that changes in the underlying data will not require any changes to the HTML.
With a few lines o f JavaScript code, you can read an external X M L file and update
the
data content of your web page.
2 X M L Simplifies Data Sharing In the real world, computer systems and
atabases contain data in incompatible formats.XML data is stored in
plain text format. This provides a software and hardware-independent
way of storing data. This makes it much easier to create data that can
be shared
by different applications.
XML DOCUMENT STRUCTURE OR COMPONENENT OF
XML
X M L DECLARATION
XML declaration contains details that
prepare an XML processor to parse the
XML document. It is optional, but when
DOCUMENT used, it must appear in the first line of
PROLOG SECTION the XML document. <?xml version =
Document Prolog comes at the "version_number" encoding =
top of the document, before "encoding_declaration" ?>
the root element. This section It defines the XML version (1.0) and the
contains − encoding information such as ISO-
• XML declaration 8859- 1,UTF-8,UTF-16
• Document type declaration e.g
<?xml version="1.0" encoding="ISO-
8859-1"?>
Document Elements
Section
DOCUMENT ELEMENTS ARE THE BUILDING BLOCKS OF XML. ELEMENTS
CA N BEHAVE AS CONTAINERS T O HOLD TEXT, ELEMENTS, ATTRIBUTES
ETC
<ELEMENT-NAME ATTRIBUTE1 ATTRIBUTE2> ....CONTENT
</ELEMENT- NAME>
•ELEMENT-NAME IS THE NAME OF THE ELEMENT. THE NAME ITS CASE
IN THE S TAR T AND END TAGS MUST MATCH.
A MA RKUP CONST RUCT T HA T BEGINS WIT H < A ND ENDS WIT H >.
T A GS COME IN T HREE WA Y S
• START-TAGS; FOR EXAMPLE: <SECTION>
• END-TAGS; FOR EXAMPLE: </SECTION>
• EMPTY-ELEMENT TAGS; FOR EXAMPLE: <SECTION/>
•ATTRIBUTE1, ATTRIBUTE2 ARE ATTRIBUTES OF THE ELEMENT
SEPARATED BY WHITE SPACES. A N ATTRIBUTE DEFINES A PROPERTY OF
THE ELEMENT. IT ASSOCIATES A NAME WITH A VALUE, WHICH IS A
STRING OF CHARACTERS. A N ATTRIBUTE IS WRITTEN AS NAME=”VALUE”
XML SYNTAX
1 All XML Elements Must Have a Closing Tag
InRULES
HTML, some elements do not have to have a closing tag:
<p>This is a paragraph.In XML, it is illegal to omit the closing tag. All
elements must have a closing tag:<p>This is a paragraph.</p>
2. XML Tags are Case Sensitive
XML tags are case sensitive. The tag <Letter> is different from the tag <letter>.Opening and
closing tags must be written with the same case:<Message>This is incorrect</message>
<message>This is c orrect</message>
3. XML Elements Must be Properly Nested
In HTML, you might see improperly nested elements:<b><i>This text is bold and italic</b></i>
In XML, all elements must be properly nested within each other:<b><i>This text is bold and
italic</i></b
4. XML Documents Must Have a Root Element
XML documents must contain one element that is the parent of all other elements. This element is called
the root element.<root>
<child>
<subchild>.....</subchild>
</child>
X M L 2 type of
reference
1. Entity References:
Some characters have a special meaning in XML. If you place a character like "<" inside an
XML element, it will generate an error because the parser interprets it as the start of a new
element.
2. Character References:
A character reference gives the number of the particular Unicode
character it stands for, in eit her decimal or hexadecimal.
Dec imal character references look like &# hexadecimal character references
have an extra x after the &#&#;, that is, they look like &#
APPLICATION OF X M L
1.Web publishing
X ML all ows t he dev el opers t o sav e t he dat a int o X ML f il es & use X SLT
transformation
API’S to generate content in the required format such as HTML, X H T M L
2. Web Searching
It can use X M L data & then search the data from the X M L file & display it to
the user
3. Data Transfer
It can use X M L to save configuration or business data for our application
4. Created Other languages
Many language are created using X M L such as WML
QUESTIONS? Email Address
CLA RIF ICA T IONS sachin.zurange@gmail.com
?
Please feel free to contact me,
Teacher Sachin Zurange through email or phone.
Mobile Number
(9822506209/9823037693)
Consultation Hours
4 PM to 6 PM