• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

XML question

Zucarita9000

Golden Member
I'm creating this XML file for a flash website for a local architect. The flash file handles all the xml parsing functions, and I have to write the xml with all the site's data.

Here's an example. I have to show very basic info for every project, such as Client, Year, Location, etc. What I need to know is wich is the best way to store the data, should I create elements for every item or simply use attributes for a single element?

Using elements:

<project id="01">
<client>Mr. Jones</client>
<year>1999</year>
<location>Malibu</location>
</project>

Using attributes:

<project id="01" client="Mr. Jones" year="1999" location="Malibu"></project>

Both methods are equally valid, but what are the "best practices" when handling XML data? As you may notice, this is the first time I write and XML file.
 
Use elements when possible. They are easier to manipulate in code and XSLT, and they allow for more complex data storage. W3Schools discusses this topic pretty well.
 
Back
Top