XML syntax
The syntax of XML is very eazy and very eazy to use.As i told you XML is case sensitive so before coding be aware of this.
ok lets write the fisrt XML document.
|
<?xml version="1.0"?>
<school>
<student1>rama</student1>
<address>4131 e 200 w</address>
<phone>801-222-222</phone> <school>
|
The first line is the xml declaration-defines XML version .
The next line describe the root of the element of the document(<school>)
The next 3 lines describe the child elements of the root(student1,address,phone)
|
<student1>rama</student1>
<address>4131 e 200 w</address>
<phone>801-222-222</phone>
|
Let's imagine that we created an application which output's student information from the XML document to produce this output:
School
Student-rama
address-4131 s 200 w
phone--801-222-222
|
example2
<employee>
<title>my company employee</title>
<name>hari
<address>400w 300 e</address>
<phone>333-333-33</phone>
</name>
<name>rama
<address>4100w 400 e</address>
<phone>133-133-33</phone>
</name>
</employee>
|
note
All XML elements must have a closing tag
In HTML some elements do not have to have a closing tag. The following code is legal in HTML:
<p>some text hear
<p>This paragraph
In XML all elements must have a closing tag, like this:
<p>some text here</p>
<p>This is paragraph</p>
|