Answer» I am making my first XML file and I'm trying to decide the best way to structure the data. It contains a LIST of file types and their CORRESPONDING description and some other info.
My program (PHP) finds the extension of a file, then it needs to load the other data corresponding to that file. The XML needs to contain the extension, description, class, and icon path.
txt This is a text document text text.png
or
...
or
...
I'm not sure how to structure the XML best for the way I want to READ it.if the values are unlikely to have a heirarchy of sub-nodes, use attributes. I cannot think of any good reason for the values yo mention to ever require additional nodes or even their own attributes, so I'd GO with attributes on the node.so you mean like this: Exactly.
You should of course be using the XML Parser for PHP, if you are using PHP. Don't try to parse XML yourself. It will only END in tears.
|