• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

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).
0
cindyrod
Asked:
cindyrod
  • 2
  • 2
2 Solutions
 
jkmyoungCommented:
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.

Disadvantages:
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.
0
 
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?)

THANK YOU SO MUCH FOR YOUR HELP!!
0
 
jkmyoungCommented:
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.
0
 
cindyrodAuthor Commented:
Thank you so much for your help. That was exactly what I needed to know. THANKS!!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now