iTech College - Internet Technology, Online Education, E-Learning, Technician Training, Tech Tutorials, Distance Education, Virtual Learning XML Course: XML Format and Structure - www.itechcollege.com XML Course: XML Format and Structure - www.itechcollege.com
Free Courses
HTML
JavaScript
CSS
ASP
PHP
JSP
C++
ASP.NET
SQL
AJAX
FTP
XML

courses > XML > XML Format and Structure

XML Format and Structure

A XML document is consist of tags and data. All data in an XML document is wrapped by the tags. Let's see an example:

<?xml version="1.0" encoding="ISO-8859-1"?>
<customer>

<firstname>Michael</firstname>
<lastname>Smith</lastname>
<gender>male</gender>

<address>

<street>197 West Park Ave.</street>
<city>New York</city>
<state>NY</state>
<zip>11375</zip>
<country>US</country>

</address>

<phone>718-235-5670</phone>
<email>msmith278@yahoo.com</email>

</customer>

The first line is the XML declaration. It defines the XML version (1.0) and the character set (ISO-8859). The next line uses tag "<customer>". It is the root element of the document. The next four lines describe the child elements () of the root: Please note that, except the first line, all tags in the document are used in pair: opening tag and closing tag. You can assume, from the above example, a pair of tags provide a "container", and data or child tags are stored inside.

Also, you can assume, the structure of an XML document is defined by the relationship between these "containers": a large container contains smaller containers. Or you can assume the structure of an XML file as a "tree" that starts at the root tag "customer" and branches to the leaves tags "firstname", "lastname", "gender", "address", "phone" and "email":

customer -> 	firstname
 		lastname
 		gender
 		address -> 	street
				city
				state
				zip
				country
 		phone
 		email

Please note, an XML document must contain a pair of root tags for the "parent" element, whcih contains all other elements. You cannot have two roots in a single XML document. All elements can have child elements:

<root>
<child1>......</child1>
<child2>
<subchild1>.....</subchild1>
<subchild2>.....</subchild2>
</child2>
</root>



  Back to Index Page
 Next Page:  

XML Introduction
XML Format and Structure
XML Elements
XML Attributes
XML Syntax 1
XML Syntax 2
XML Naming Rules and Practices
XML Using CDATA for Dealing with HTML Tags
Displaying XML into HTML
XML Parser
XML DOM
XMLHttpRequest Object 1
XMLHttpRequest Object 2
XMLHttpRequest Object 3
Create an XML File From a Database 1
Create an XML File From a Database 2
Save XML File on Server


Online Education, Online Training for Your Job, Distance Education, E-learning Programs for Your Career!Online Colleges, Online Universities, E-learning & Distance Education for Your Career! Easy Job Training & Online Courses.


   Email A Friend  
 
Earn Online Degree
for Your Job
I found a job after I earned an online degree!
Online classes for finding a Job. Online College, Online University, Degrees, E-learning school, online certificate Earn your
online degree now!
Online Training
for Good Job
Why I work so hard but earn so little? Why I cannot find a high paying job?
Online training for a Good Jobs. Online Degree, E-learning school, online certificate Go to
online school now!

Copyright ©2024, itechcollege.com. All rights reserved
iTechCollege | About iTech | Contact iTech