Jump to content
  • Advertisement
Sign in to follow this  
DarkSlayer

xml - how to organise this

This topic is 4997 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok, if there is a better xml forum elswehere, tell me . this is what puzzels me for now. I am going to create an xml document with a dtd. and this is what I have to record.
Olympic Atlanta 1996
  Results sprint 100m
     person: Donovan Bailey (Canada)    time: 09.84
     person: Michael March (USA)    time: 10.00
  results sprint 200m
     ....

Next olympic...
What I see here is that I can create one record of persons (name, country ++ ), and one record (game, type, results ). But wether I make an xml doc based on (game, type) and record athletes and their results .... or based on (name, country ++ ) and record game, type, results.
<?xml version="1.0"?>
<!DOCTYPE doc_root [
	<!ELEMENT doc_root (event*)>
	<!ELEMENT event (name, place, year, athletes*)>
	<!ELEMENT name (#PCDATA)>
	<!ELEMENT place (#PCDATA)>
	<!ELEMENT year (#PCDATA)>
	
	<!ELEMENT athletes (firstname, lastname, country, results*)>
	<!ELEMENT firstname (#PCDATA)>
	<!ELEMENT lastname (#PCDATA)>
	<!ELEMENT country (#PCDATA)>
	
	<!ELEMENT results (category*)>
	
	<!ELEMENT category (cat_name, type*)>
	<!ELEMENT cat_name (#PCDATA)>
	
	<!ELEMENT type (typ_name, result)>
	<!ELEMENT typ_name (#PCDATA)>
	<!ELEMENT result (#PCDATA)>
]>
<doc_root>
	<event>
		<name>Olympic games</name>
		<place>Atlanta</place>
		<year>1996</year>
		<athletes>
			<firstname>Michael</firstname>
			<lastname>March</lastname>
			<country>USA</country>
			<results>
				<category>
					<cat_name>Sprint</cat_name>
					<type>
						<typ_name>100m</typ_name>
						<result>10.00</result>
					</type>
					<type>
						<typ_name>200m</typ_name>
						<result>20.48</result>
					</type>
				</category>
			</results>
		</athletes>
		<athletes>
			<firstname>Michael</firstname>
			<lastname>Johnson</lastname>
			<country>USA</country>
			<results>
				<category>
					<cat_name>Sprint</cat_name>
					<type>
						<typ_name>200m</typ_name>
						<result>19.32</result>
					</type>
				</category>
			</results>
		</athletes>
	</event>
	<event>
		<name>Olympic games</name>
		<place>Barcelona</place>
		<year>1992</year>
		<athletes>
			<firstname>Donovan</firstname>
			<lastname>Bailey</lastname>
			<country>Canada</country>
			<results>
				<category>
					<cat_name>Sprint</cat_name>
					<type>
						<typ_name>100m</typ_name>
						<result>09.84</result>
					</type>
				</category>
			</results>
		</athletes>
	</event>
</doc_root>



or...
<?xml version="1.0"?>
<!DOCTYPE doc_root [
	<!ELEMENT doc_root (event*)>
	<!ELEMENT event (name, place, year, results*)>
	<!ELEMENT name (#PCDATA)>
	<!ELEMENT place (#PCDATA)>
	<!ELEMENT year (#PCDATA)>
	<!ELEMENT results (category*)>
	<!ELEMENT category (cat_name, type*)>
	<!ELEMENT cat_name (#PCDATA)>
	<!ELEMENT type (typ_name, athletes*)>
	<!ELEMENT typ_name (#PCDATA)>
	<!ELEMENT athletes (firstname, lastname, result, country)>
	<!ELEMENT firstname (#PCDATA)>
	<!ELEMENT lastname (#PCDATA)>
	<!ELEMENT result (#PCDATA)>
	<!ELEMENT country (#PCDATA)>
]>
<doc_root>
	<event>
		<name>Olympiske leker</name>
		<place>Atlanta</place>
		<year>1996</year>
		<results>
			<category>
				<cat_name>Sprint</cat_name>
				<type>
					<typ_name>100m</typ_name>
					<athletes>
						<firstname>Michael</firstname>
						<lastname>March</lastname>						
						<result>09.84</result>
						<country>USA</country>
					</athletes>
					<athletes>
						<firstname>Donovan</firstname>
						<lastname>Bailey</lastname>						
						<result>10.00</result>
						<country>Canada</country>
					</athletes>
				</type>
				<type>
					<typ_name>200m</typ_name>
					<athletes>
						<firstname>Michael</firstname>
						<lastname>March</lastname>						
						<result>19.32</result>
						<country>USA</country>
					</athletes>
					<athletes>
						<firstname>Michael</firstname>
						<lastname>Bailey</lastname>						
						<result>20.48</result>
						<country>Canada</country>
					</athletes>
				</type>
			</category>
		</results>
	</event>
	<event>
		<name>Olympiske leker</name>
		<place>Barcelona</place>
		<year>1992</year>
		<results>
			<category>
				<cat_name>Sprint</cat_name>
				<type>
					<typ_name>100m</typ_name>
				</type>
				<type>
					<typ_name>200m</typ_name>
				</type>
			</category>
		</results>
	</event>
</doc_root>



if there is a better way to avoid re-typing the same info over and over again, tell me about it. Now I have to choose to retype each athletes, or each game ...

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!