Jump to content
  • Advertisement
Sign in to follow this  
plywood

getting started with XML

This topic is 3829 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

Let's say I want to create a simple XML script that looked like:
<computer>
<cpu>Intel 3086</cpu>
<motherboard>ASUS</motherboard>
<memory>
<cache>L2</cache>
<disk>80GB</disk>
</memory>
</computer>

What is the process involved in creating this? What software/parsers or other technologies are involved, and what is the sequence in using them all?

Share this post


Link to post
Share on other sites
Advertisement
You just created it. I presume you used a text editor (or the form entry field here on GameDev).

I think you have missed out on the point of XML: it's a self-describing data language, where formatted data is enclosed in fields that are semantically meaningful and provide information about the relationships between individual data fields. Of itself, it's just text; no special tools are needed to create it. The question is what information you wish to store as XML, what sources you wish to obtain it from, and what destinations you wish to send it to.

Share this post


Link to post
Share on other sites
XML is a way of labeling information, and a way of organizing it thats better than say writing configuration information to a text file, but no where near as powerful as a database. Its good for simpler tasks essentially. Knowing xml code is good, so you understand how it works. But usually one will create a parser to work with it and write it for them. MSN messenger uses XML for message history. C# uses xml for parts of the GUI.

Share this post


Link to post
Share on other sites
If you want to concisely and exactly describe the structure of your document, you can use a DTD (simple but somewhat outdated) or an XSD (more complex and powerful... and, IMHO, nicer). That's entirely optional, though... probably only useful if you actually need schema checking or have a code generation tool which takes them as input.

If what you want is to take that file you've got there and access its data from your program, you'll want a good XML library. My preferred library is TinyXML for iterating through the document. TinyXPath allows XPath queries, for more powerful data iteration (though of course you'll need to know XPath for that).

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
If you want to concisely and exactly describe the structure of your document, you can use a DTD (simple but somewhat outdated) or an XSD (more complex and powerful... and, IMHO, nicer). That's entirely optional, though... probably only useful if you actually need schema checking or have a code generation tool which takes them as input.

If what you want is to take that file you've got there and access its data from your program, you'll want a good XML library. My preferred library is TinyXML for iterating through the document. TinyXPath allows XPath queries, for more powerful data iteration (though of course you'll need to know XPath for that).


XSD is also known as a schema. It is nicer than DTD. Im using this book here in class, its pretty good. Im running through the tutorials. http://www.amazon.com/New-Perspectives-Second-Comprehensive-Pespectives/dp/1418860646 My teacher also posted this link for java and xml. But it doesnt really have exercises or anything with it. Its more of a reading book then an educational/academic setting book. http://www.cafeconleche.org/books/xmljava/

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!