Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

Online

À la maison Codes sources E-Livres Téléchargements Nous contacter Au sujet de nous

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
AJAX Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PHP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
.NET (dotnet)
Microsoft.Net
XML Web Services
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills


Elements of XML
Previous Next



Elements of XML


To create an XML document elements are used. Lets assume that to create a document with the elements LAND, FOREST, TREE, MEADOW, GRASS. Here how we use of these all elements :



XML Elements are Extensible
To carry more information XML documents can be extended.
XML example:

<LAND>
  <FOREST>
   <TREE>Oak</TREE>
   <TREE>Pine</TREE>
   <TREE>Maple</TREE>
  </FOREST>
  <MEADOW>
   <GRASS>Bluegrass</GRASS>
   <GRASS>Fescue</GRASS>
   <GRASS>Rye</GRASS>
  </MEADOW>
</LAND>

 


Each element is enclosed in <> brackets. The element must be end with '/' character before its name. XML requires one element like that contains all others. This single element("LAND"), is called the root element. The FOREST element contains several TREE elements, and the MEADOW likewise contains several elements of GRASS.

Elements that are included in another element are called nested element. The TREE elements nested in the above example are nested in the FOREST element.The FOREST element is the parent element to the TREE element and the TREE element is also called the sub-element to the FOREST element. These relationships hold true as you move up and down the element hierarchy. The FOREST and MEADOW elements are sub-elements to the LAND root element.

The below example is not well formed:

<LAND>
  <FOREST>
   <TREE>Oak</TREE>
   <TREE>Pine</TREE>
   <TREE>Maple
  </FOREST>
</TREE>
  <MEADOW>
   <GRASS>Bluegrass</GRASS>
   <GRASS>Fescue</GRASS>
   <GRASS>Rye</GRASS>
  </MEADOW>
</LAND>

 




Element Tags
For all elements that have content,XML elements require both a beginning tag and an ending tag.
Elements with content :

<TREE>Oak tree</TREE>

Elements without content may be expressed as:

<NOTHING></NOTHING>

In short it may be expressed as:

<NOTHING/>

Elements with no content may be used to display graphics and other material in the document.
 




First XML

Introduction to XML

  • What is HTML


  • What is XML
XML Syntax

  • Elements must have a closing tag


  • Elements must be properly nested
Imagine that this XML document describes the book:
<book>
<title>First XML</title>
<prod id="33-657" media="paper"></prod>
<chapter>Introduction to XML
<para>What is HTML</para>
<para>What is XML</para>
</chapter>
<chapter>XML Syntax
<para>Elements must have a closing tag</para>
<para>Elements must be properly nested</para>
</chapter>
</book>

Book is the root element. Title, prod id, and chapter are child elements. Book is the parent element of title, prod, and chapter. Title, prod, and chapter are siblings because they have the same parent.




The Content Of Element

Elements may contain:

  • Nested elements


  • Processing instructions


  • Normal text.


  • CDATA sections - it consistspecial characters which is not displayed normally by the browser such as less than or greater than sign. These signs are used to enclose tags and are special characters. An example CDATA section:

<![CDATA[
The < and > characters are displayed normally here.
]]>


  • Entity references - An entitity reference is not allowed by a & sign.


  • Character references - Character References are not displayed normally in XML such as the < or > characters. These characters are represented as &#40 and &#42 respectively and will be presented on the browser as the less than or greater than character they represent.



  • Comments - Comments are shown below and may be placed anywhere except an element tag (markup).


  • <!-- comment not display by browser -->



Naming Convention
These naming rules must followed by XML elements:
  • it consist letters, numbers, and other characters
  • Names must not start with a number or punctuation character
  • Names must not start with the letters xml (or XML, or Xml, etc)
  • Names cannot contain spaces

Take care when you "invent" element names and follow these simple rules:

Any name can be used, no words are reserved, but the idea is to make names descriptive. Names with an underscore separator are nice.

Examples: <first_name>, <last_name>.

Avoid "-" and "." in names. For example, if you name something "first-name," it could be a mess if your software tries to subtract name from first. Or if you name something "first.name," your software may think that "name" is a property of the object "first."

Element names can be as long as you like, but don't exaggerate. Names should be short and simple, like this: <book_title> not like this: <the_title_of_the_book>. 

XML documents often have a corresponding database, in which fields exist corresponding to elements in the XML document. A good practice is to use the naming rules of your database for the elements in the XML documents.

Non-English letters like éòá are perfectly legal in XML element names, but watch out for problems if your software vendor doesn't support them.

The ":" should not be used in element names because it is reserved to be used for something called namespaces (more later).




Previous Next

Keywords: naming convention, universal naming convention, naming convention prefix, naming convention language


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
AJAX Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PHP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
XML Web Services Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz

Privacy Policy
Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.