Skip to Content
.NET & XML
book

.NET & XML

by Niel M. Bornstein
November 2003
Intermediate to advanced
476 pages
14h 38m
English
O'Reilly Media, Inc.
Content preview from .NET & XML

Hierarchical XML

XML that comes from a database, whether generated directly from a DataSet or through an XmlDataDocument, is inherently relational. That is, each table is represented by a single element, and its columns are represented by elements within it. Relations between tables are indicated by foreign key constraints and row identifiers. This makes perfect sense for relational data, but sometimes you might want to use a more hierarchical format.

XML is ideal for representing hierarchical data, because it is itself a tree-oriented format. The data from the coupon database could easily be represented in a combination of relational hierarchical XML structures, as shown in Example 11-12.

Example 11-12. Hierarchical representation of coupon database
<AngusHardware> <customers> <customer_id>1</customer_id> <name>Mark's Roofing</name> <address1>99 Beltline Pkwy</address1> <address2>Suite 100</address2> <city>Wannaque</city> <state>NH</state> <zip>05461 </zip> </customers> <coupons> <coupon_code>077GH </coupon_code> <discount_amount>15</discount_amount> <discount_type>0</discount_type> <expiration_date>2002-11-09T14:17:41.6370000-05:00</expiration_date> </coupons> <coupons> <coupon_code>665RQ </coupon_code> <discount_amount>15</discount_amount> <discount_type>0</discount_type> <expiration_date>2002-11-30T00:00:00.0000000-05:00</expiration_date> <coupon_redemptions> <coupon_code>665RQ </coupon_code> <total_discount>21.5</total_discount> <redemption_date>2002-11-10T00:00:00.0000000-05:00</redemption_date> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Applied XML Programming for Microsoft® .NET

Applied XML Programming for Microsoft® .NET

Dino Esposito
XML Hacks

XML Hacks

Michael Fitzgerald

Publisher Resources

ISBN: 0596003978Supplemental ContentErrata