Sunday, 3 June 2012

How to make an XML document


An XML document can be thought of as an HTML document. However in the case of XML, you can define your own tag names, attributes and their values. XML documents can be created in a text editor (such as notepad) and saved with an .xml extension.

All valid XML documents must contain an XML declaration which is currently <?xml version="1.0"?>. Also a root element is needed. In this example the root element is <books>. The number of child elements within the root (in this case <book>) is unlimited.

<?xml version="1.0"?>
<books>
   <book>
 <title>OpenGL Programming Guide Fourth Edition</title>
 <location>107</location>
 <publisher>Addison-Wesley</publisher>
 <year>2004</year>
   </book>
   <book>
 <title>Curves and Surfaces for CAGD: A Practical Guide</title>
 <location>116</location>
 <publisher>Academic Press</publisher>
 <year>2002</year>
   </book>
   <book>
 <title>An Introduction to NURBS: With Historical Perspective</title>
 <location>120</location>
 <publisher>Academic Press</publisher>
 <year>2001</year>
   </book>
   <book>
 <title>NURBS: From Projective Geometry to Practical Use</title>
 <location>126</location>
 <publisher>A K Peters</publisher>
 <year>1999</year>
   </book>
</books>

0 comments:

Post a Comment