How to organize XML files and difference to Database

I'm trying to learn XML and use it on a site with many articles that can be modified after being created.

1) Should I have a folder in my site to save all the articles, one article per XML file, or should I put all the articles in a single XML file?

2) Is it faster or better to save the information for the articles in a database or in an XML file?

You see, every article is going to have different parts (paragraphs, images, etc.) and any part can be modified or deleted, and more parts can be added to the article at any time (For the images, I'm just going to save the URL and save the image in a folder).
Who is Participating?
This really depends on the size of your articles, and the number of articles you intend to have.

Knowing nothing else, I'd recommend one xml file per article; benefits:
Easier to load/save a single article, instead of all the articles.
Easy to modify a single article without changing anything else.

Harder to search through; however, you could overcome this with indexes.

Would you have an xml directory file pointing to the rest of these articles?

2) A large benefit of XML to Databases is the embedded structure of xml, which automatically implies relationships between parts and parent elements. eg paragraphs and images are tied to an article by the file structure instead of having to have a table to layout all the relationships.
Furthermore, an article in XML is more easily converted to an HTML page, perhaps through XSLT or other methods.
cindyrodAuthor Commented:
1) I guess I can have an xml directory file pointing to the articles, how would I do that? Is it just an XML file with the ID of all the articles or is it some kind of special XML file?

2) Would you recommed to just load the XML file with XSLT to display it correctly or would it be better to parse through the file and display it using a server side language? (Does this make sense?)

1) I was originally thinking of just an xml file with the id's. It really depends on what you want to do with your articles, eg, if you wanted to have a quick rss like summary of your articles. This need not even be in xml format.

2) If there are going to be many views of this page, I recommend converting the page on the server. You can store the result of converting the xml to html.
So when someone requests the page, you can check the dates of the result file and the xml file, and only re-run the transformation when necessary.

Hope this helps.
cindyrodAuthor Commented:
Thank you so much for your help. That was exactly what I needed to know. THANKS!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.