Do you receive the Programmer's Heaven newsletter? If not, why not subscribe?
*/

Other Views

corner
*/

How to Create Nested Elements in an XML Document

How to create nested elements in an XML document?

An XML document can be thought of as a database. In the following example, the <book> element has the same function as a database table that holds the child element records such as <title> or <location>.

A brief definition of “Nested elements”: Child elements can contain further child elements themselves. As in the example: The <location> element has a <department> and a <room> child element.

<?xml version="1.0"?>
<books>
   <book>
	<title>OpenGL Programming Guide Fourth Edition</title>
	<ISBN>0321173481</ISBN>
	<author>Michael R. Sweet</author>			
	<location>
		<department>Development</department>
		<room>107</room>
	</location>
	<publisher>Addison-Wesley</publisher>
	<year>2004</year>
   </book>
   <book>
	<title>Curves and Surfaces for CAGD: A Practical Guide</title>
	<ISBN>0849371643</ISBN>
	<author>Gerald Farin </author>
	<location>
		<department>Development</department>
		<room>116</room>
	</location>
	<publisher>Academic Press</publisher>
	<year>2002</year>
   </book>
   <book>
	<title>An Introduction to NURBS: With Historical Perspective</title>
	<ISBN>1558606696</ISBN>
	<author>David Rogers</author>
	<location>
		<department>Development</department>
		<room>120</room>
	</location>
	<publisher>Academic Press</publisher>
	<year>2001</year>
   </book>
   <book>
	<title>NURBS: From Projective Geometry to Practical Use</title>
	<ISBN>1568810849</ISBN>
	<author>Gerald Farin</author>
	<location>
		<department>Development</department>
		<room>126</room>
	</location>
	<publisher>A K Peters</publisher>
	<year>1999</year>
   </book>
</books>


Back to XML FAQ
corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.
Resource Listings