XML creation: Part 2
In this guide, I'll be creating an XML file to store the Playstation games I own, and ultimately make the XML file 'pretty' for Web browsers. I've done this in the past, with my vehicle gas XML document.
In part two, I'll be creating the layout, that I think will work.
Last time ...
If you recall, in part one, I went over the idea of what the XML file would store, and what layout I thought it might need.
This time, I'll actually create the XML document's layout, using elements.
The structure realized
(There is some indenting, but it is a bit difficult to see here.)
There it is. Based upon what we determined last time, we decided that there would be individual games within one larger grouping. For the individual game, there would be information relevant to that game.
You can see this in action in most current browsers.
You may not that some browsers, such as IE 7, will change empty elements, such as <date></date> to simply <date />. Since the element contains no information, there's little need to have a closing, when the open can function as both.
If you View Source, you can usually see what really underlies the file. You can also do this for the vehicle gas XML document, which will give you a very interesting perspective of what the content is, versus the design elements.
Where we stand
Currently, the XML document has structure, but no content. This is the framework that we'll use in our next part to actually fill in some data.
However, don't be confused and think that this framework is the best it could be. In another, later, part, we'll go over a much more robust 'framework' that we should really be using.
Next time ...
In part three, I'll be filling out our framework with actual data. Once we have the data in place, we can determine what rules should be in place for each element, and then work on styling the document for display in browsers.
We'll also work on getting our XML document to validate.
Support This Site
If my blog was helpful to you, then please consider visiting my Amazon Wishlist.