Click to See Complete Forum and Search --> : NEWBIE: Basic Questions


kwilliams
12-14-2004, 08:56 AM
Thanks in advance for clarification on this issue. I've just finished reading Sam's "Teach yourself ASP.NET in 24 Hours" and "", and I feel that I'm ready to get started with some small ASP.NET apps. My questions relates to XML data storage vs. SQL Server database data storage. What is the point of storing data in database tables when XML can do pretty much the same thing? Couldn't I create apps that purely used XML/XSLT/ASP.NET? Or is there a need for SQL Server databases in this plan?

This whole concept is kind of confusing me. I'm thinking of using XML/XSLT/ASP.NET by themselves with simple applications (i.e. contact info), and using SQL Server databases for more complex applications. But clarification on the best setup would greatly be appreciated. Thanks.

baconbutty
12-14-2004, 10:16 AM
As an amateur in this area, my observations are:-

1. The choice will come down to what you want to do, what functionality you are looking for and what performance you are looking for. However if you are likely to have a large dataset, with many users reading and writing simultaneously (like these forums) then database is the obvious way to go.

2. XML alone is generally a flat text file (unless you have a native XML database).

My web site currently uses XML files for the database, but it will have to move to a database when the files get too big.

As a result:-

- The whole file has to be loaded and parsed (or you use a SAX reader) when your ASP page wants to read from it. This could put a strain on the server processors and memory for larger XML files. Particularly as each Session may need to load its own copy of the XML file (unless there is some multithreaded XML object available).

- If you are updating the content, then only one person can usually do this at a time. Or at best, XML parsers are not natively designed to allow simultaneous writes.

- Querying XML uses XPATH (which may not have the same performance as an SQL SELECT statement).

3. A database such as SQL and MySQL will offer:-

- Better performance for large datasets.
- Better support for simultaneous read/write performance (combined with ASP connection pooling)
- SELECT statements allow for more sophisticated QUERYING, accross multiple tables.

Having said that, you may still read from a database into an XML file for XSLT transformation.

kwilliams
12-14-2004, 10:23 AM
Wow, thanks for the great answer. I believe that you're right in that I'm going to choose to use XML for data storage on basic data that will only be displayed as static content through an ASP.NET page, and SQL Server for data storage of more complex data that may need to be queried or editied. Thanks for your detailed answer, as it's really helped me to understand the best way of doing things concerning data storage.

But I do have 2 more question thoughs, and hopefully you can answer them for me. Is it better to display basic data with XML & XSLT or with XML & ASP.NET? What is the need for ASP.NET when you can display data using XML & XSLT? Thanks.

baconbutty
12-14-2004, 10:37 AM
Hi, glad to be of some assistance.

I will defer to experts in the forum on this, but from my perspective the decision is a matter of taste and functionality (and you can use a combination of both of course):-

1. XSLT

This requires an XSLT compliant browser (i.e. the processing is done by the browser). Most modern browsers should be.

I would say that for regular simple static data which is simply being read and presented in a standard template HTML form, then XSLT is perhaps better and quicker (once you have learned the XSLT and XPATH languages!)

A good page on this is:-

http://www.w3schools.com/xsl/xsl_transformation.asp


2. ASP

You will need the server side processing ability of ASP, PHP etc, where:-

- You are reading from a database, to construct your XML file.
- You need to carry out any other processing in order to build up the content of your page, such as read information from the Request object etc. I.e. you need to do more than simply represent static XML data.

kwilliams
12-14-2004, 10:48 AM
Cool. Exactly what I needed to know. Thanks and have a great week.