XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old May 30th, 2002, 06:51 AM
blaz blaz is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Ljubljana, Slovenia, Europe
Posts: 29 blaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Database vs. XML

I can't realy get to understand how could XML be useful to store data for a database-driven web site. Isn't data already described when properly put in the database. I read about how to use XML to store content, and than use XSLT to create XHTML (layout), and use CSS to apply design to XHTML layout. But what I didn't get is when I read "...and you store your XML data into a database". What is the purpose of storing XML marked content into a database?
And when I think about dinamyc data driven web site, it seems illogical to use XML at all. If I want to do queries on my data it is best (I think) for the data to be in a database. For example: If I wanted to count how many articles were published on my site. This seems harder (and slower) to do without a database. It seems logical to use XML for exchanging data between different systems. But how could this benefit me at bulding non-static sites?

Well this are some of my thoughts. Please make some comments and enlighten me. How shoud I use these techologies?

Reply With Quote
  #2  
Old May 31st, 2002, 10:02 AM
torrent torrent is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: UK
Posts: 59 torrent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
My sentiments exactly. I also fail to understand the reasons behind it. I can see benefits of XML in the sense that you have an architectural, platform and database engine free means of describing your data. So in terms of portability it's excellent.

However, when trying to understand it's benefit over a database on sites that don't need to share information is harder to understand.
__________________
Torrent
www.ski-info-online.com

...silently carving the soft deep powder...

Reply With Quote
  #3  
Old June 3rd, 2002, 12:06 AM
Andrew-J2000 Andrew-J2000 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: London
Posts: 4 Andrew-J2000 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Andrew-J2000 Send a message via AIM to Andrew-J2000 Send a message via MSN to Andrew-J2000 Send a message via Yahoo to Andrew-J2000
Well, the purpose of xml is to add structure to documents. If you have a database to populate an xml page, it will allow the user to interact with the xml dom, thus allowing the queryed arguments for sorting the page without reloading the page and pulling the content from mySQL, therefore saving resources as well.

Reply With Quote
  #4  
Old June 8th, 2002, 01:34 PM
edwinx edwinx is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Location: vancouver, bc
Posts: 142 edwinx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 36 m 43 sec
Reputation Power: 9
Send a message via ICQ to edwinx
Quote:
Originally posted by Andrew-J2000
Well, the purpose of xml is to add structure to documents. If you have a database to populate an xml page, it will allow the user to interact with the xml dom, thus allowing the queryed arguments for sorting the page without reloading the page and pulling the content from mySQL, therefore saving resources as well.


Hi,

can you provide an example or a link to an example that does that you just said?

I'm still trying to 'understand' xml and an example of what you said would be perfect.

thanks
edwin
__________________
I know nothing

Reply With Quote
  #5  
Old June 10th, 2002, 08:22 AM
binky's Avatar
binky binky is offline
Gerbil
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Oct 2001
Location: In a Rotastak
Posts: 1,763 binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level)binky User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 22 h 12 m 52 sec
Reputation Power: 18
An example could be this:

We have a program that uses a folder tree. The tree itself is organised within a database, the underlying filesystem is flat. So 'here>there>everywhere>file.jpg' exists at 'files>file.jpg' and not where it would appear to be. A PHP script queries the database to create an XML file representation of this folder tree. This XML file is easily parsed into a physical representation of a collapsing/expanding folder tree, that maintains the illusion. Because an XML file is being created it means that the file can be used by more than one application, which it is, without more database connections being made. It also means that a state can be saved so that when the page is reloaded the folder tree remains in the expanded state that it was left in. If a file/folder is added then the XML file is recreated, otherwise it is the same file that is used for subsequent uses.

Another use for XML database interaction is to have two dimensions within a table. If some data is going to be static, instead of having a lookup table you can simply insert the data as a blob of XML that can parsed on retrieval, it may go against the RDB and data integrety concept but it makes things quicker and simpler, which is sometimes needed. For example, you could 'roll up' all the news from today into a single XML file and put in a database table with fields NEWS_DATE and NEWS_TEXT, then you would have a simple store but retain a degree of formatting possibility by inserting all the news as one blob of XML. It's tidier than having a massive number of entries for one day.
__________________
- Sorted!

www.ppfuk.com - Free Photo Sharing

Reply With Quote
  #6  
Old June 10th, 2002, 08:33 AM
Hero Zzyzzx's Avatar
Hero Zzyzzx Hero Zzyzzx is offline
11
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jul 2001
Location: Lynn, MA
Posts: 4,632 Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 23 h 12 m 33 sec
Reputation Power: 76
Send a message via AIM to Hero Zzyzzx
You can also use XML files in a way similar to what binky mentioned for a cheapo "version control" system in a CMS.

When a document is edited, you create an XML version that represents the document at it's current state. You then store this XML version, along with an ID and a datetime string in a table. You can now list different versions of document over time and restore them if needed. Works pretty slick. If you're a perl person, check out XML::Simple and/or Data::Dumper to make this easy as pie.

Reply With Quote
  #7  
Old June 14th, 2002, 01:36 AM
Ted Striker Ted Striker is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 409 Ted Striker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Question

So let me see if I've got the idea:

1) I want to retrieve a list of titles of books.

a. SELECT title, date FROM books;

b. Then I use PHP to pull the data from my database and paste it to the client browser.

2) But the user wants to also be able to sort this data by the date:

a. SELECT title, date FROM books ORDER BY date;

b. Then paste the data again using PHP

If I were to use XML, I could transfer the duty of ordering the data completely to the client browser, thus bypassing the two steps in #2 above, completley? I would just use the data already retrieved in #1, and have XML tell the browser to do the sorting? If so, now that sounds like a good deal indeed.

That would essentially cut the resource load on the server in half.

Reply With Quote
  #8  
Old June 14th, 2002, 01:58 AM
torrent torrent is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: UK
Posts: 59 torrent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Quote:
Originally posted by Hero Zzyzzx
You can also use XML files in a way similar to what binky mentioned for a cheapo "version control" system in a CMS.

When a document is edited, you create an XML version that represents the document at it's current state. You then store this XML version, along with an ID and a datetime string in a table. You can now list different versions of document over time and restore them if needed. Works pretty slick. If you're a perl person, check out XML::Simple and/or Data:umper to make this easy as pie.
That's a neat idea. Thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Database vs. XML


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway