Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Design question... Hierarchical data

Status
Not open for further replies.

rtgordon

Programmer
Jan 17, 2001
104
0
0
US
I am trying to determine the best approach for a data source that will drive a drill down list. I have started over on a design three times.

The data is like this:

Pants
Cargo Pants
Denim Cargo Pants
Button Fly
Zipper Fly
Khaki Cargo Pants
Button Fly
Zipper Fly
No Fly
Dress Pants
Cuffed Dress Pants
Lined Dress Pants
Unlined Dress Pants
Pleated Dress Pants
Flat Front Dress Pants
Uncuffed Dress Pants
Lined Dress Pants
Unlined Dress Pants
Pleated Dress Pants
Flat Front Dress Pants
Shorts...

Is this a good candidate for an XML solution? If so, what would my xml document look like?

Thanks!
gordon
 
Here are a multitude of different ways to setup the XML files. I kind of like the first and last the best:

Code:
<clothing>
	<pants>
		<cargo>
			<denim>
				<pant>Button Fly</pant>
				<pant>Zipper Fly</pant>				
			</denim>
		</cargo>
		<cargo>
			<khaki>
				<pant>Button Fly</pant>
				<pant>Zipper Fly</pant>
				<pant>No Fly</pant>
			</khaki>
		</cargo>
	</pants>
</clothing>

<clothing>
	<pants type="cargo" style="denim">
		<pant>Button Fly</pant>
		<pant>Zipper Fly</pant>				
	</pants>
	<pants type="cargo" style="khaki">
		<pant>Button Fly</pant>
		<pant>Zipper Fly</pant>
		<pant>No Fly</pant>
	</pants>
</clothing>

<clothing>
	<pants>
		<pant type="cargo" style="denim">Button Fly</pant>
		<pant type="cargo" style="denim">Zipper Fly</pant>
		<pant type="cargo" style="khaki">Button Fly</pant>
		<pant type="cargo" style="khaki">Zipper Fly</pant>
		<pant type="cargo" style="khaki">No Fly</pant>
	</pants>
</clothing>

<clothing>
	<pants>
	    <type id="cargo">
			<style id="denim">
				<pant>Button Fly</pant>
				<pant>Zipper Fly</pant>			
			</style>			
			<style id="khaki">
				<pant>Button Fly</pant>
				<pant>Zipper Fly</pant>
				<pant>No Fly</pant>	
			</style>			
	    </type>	    
	</pants>
</clothing>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top