Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 14th, 2005, 9:57 AM   #1
bja888
Hobbyist Programmer
 
bja888's Avatar
 
Join Date: Oct 2005
Location: Central, FL
Posts: 213
Rep Power: 0 bja888 is an unknown quantity at this point
Send a message via AIM to bja888 Send a message via Yahoo to bja888
When to use xml

I was reading a different thread about how over used xml is. I have also recently gained a understanding of xml. It excitetes me sexually. (but that beside the point)

I'm a big anti database person and pro file storage. I used to store everything in txt files. Now I am doing that in xml. All my recent projects have used xml and It works great.

Correct me if I am wrong...
Database - Many instances of many different values
xml - longer strings, many values and sub-categorys
txt - few values, extremely long values
bja888 is offline   Reply With Quote
Old Oct 14th, 2005, 10:04 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
Database: an organized body of related information
wordnet.princeton.edu/perl/webwn
Wrong. Properly constituted XML and text files are simply examples of databases. Database != Relational Database.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 14th, 2005, 10:18 AM   #3
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
i view xml as a tool to store properties (ie config files for a program/website). All other data IMHO is stored in a Relational DB.

Then again, that's just my opinion.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Oct 14th, 2005, 6:19 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Modern database management systems such as MySQL, PostgreSQL, Oracle etc. have huge advantages over text files. They're transaction- and queue-based, so if two applications or scripts (or two instances of the same application or script) want to access the database at the same time, the queries are placed into a queue and dealt with one at a time. With a text file, you could either lock the file, causing the script trying to access the file second to fail, or allow both to write, which could result in something like this:
The first script wroThe second script wrote this.te this.
Not good. Database management systems have their purposes. Read up on them and figure out what those purposes are. Sure, they shouldn't be used for everything, but they're very useful nonetheless.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Oct 14th, 2005, 6:50 PM   #5
bja888
Hobbyist Programmer
 
bja888's Avatar
 
Join Date: Oct 2005
Location: Central, FL
Posts: 213
Rep Power: 0 bja888 is an unknown quantity at this point
Send a message via AIM to bja888 Send a message via Yahoo to bja888
Well, what about xml? I have never been a big fan of databases. Although I am useing a Database/xml combo on Optimal Source
bja888 is offline   Reply With Quote
Old Oct 14th, 2005, 7:26 PM   #6
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Did you read my post? XML will suffer from the same problems as standard text files. That's all they are, after all.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Oct 14th, 2005, 7:35 PM   #7
bja888
Hobbyist Programmer
 
bja888's Avatar
 
Join Date: Oct 2005
Location: Central, FL
Posts: 213
Rep Power: 0 bja888 is an unknown quantity at this point
Send a message via AIM to bja888 Send a message via Yahoo to bja888
I though thats what you ment but I wasn't 100% sure.
bja888 is offline   Reply With Quote
Old Oct 14th, 2005, 7:58 PM   #8
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
When given a more or less compliant set of XML classes (such as with .Net) that support namespaces, XSLT, and Xpath, it's easier to use XML than not. For example, using .Net, I retrieved the forum's RSS feed and extracted the most recent post using just a few lines of code.

However, as noted, XML isn't as suited to replace a database as it is to transfer information. Consider RSS. It can be generated on the fly by a script for the news site/forum/blog/etc, be read by any XML reader (even if it doesn't understand it), be verified against the RSS schema, transformed into something else such as HTML using XSLT, or perhaps displayed in an aggregator. Those are some huge advantages.

Your example of saving rapidly changing data in xml is flawed as Ooble stated. However, consider the possibility of, instead of having your script return an HTML document, construct an XML document on the fly from a database backend. You have the best of both worlds. But what's the big deal with sending an XML document to the client? You are sending the data and only the data. Attach an XSL stylesheet and the client can a) interpret your data how it wants, since for example you may want a desktop app in the future, or b) use the stylesheet to convert the data into the presentation (HTML in this case, though PDF can be useful). Imagine also the savings in bandwidth if only the contents of the page are sent for each request, and the presentation aspect only once (Caching the stylesheet).
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Oct 14th, 2005, 11:06 PM   #9
bja888
Hobbyist Programmer
 
bja888's Avatar
 
Join Date: Oct 2005
Location: Central, FL
Posts: 213
Rep Power: 0 bja888 is an unknown quantity at this point
Send a message via AIM to bja888 Send a message via Yahoo to bja888
I like... no! I LOVE the way xml handles data (c#) root, node, element, attribute it allows you to get right down to the information. Like for the blog I am writing. Each entry has its own xml file (in an offline folder). Every image attachment has a "<image>" node so I just create a xmlList var and for loop though it. I know I can accomplish the same think in a database but I don't like the idea of using a single large column and very few small ones. Now that I think about it... I don't use xml for any rapidly changing items.
The program I am writing (my first with a purpose ) stores log type data (time, action, ect.) as xml. That’s only because I want a bunch of options for the ways you can export the data. Does that sound reasonable?
bja888 is offline   Reply With Quote
Old Oct 15th, 2005, 6:19 AM   #10
nindoja
Programmer
 
Join Date: Jun 2005
Posts: 92
Rep Power: 4 nindoja is on a distinguished road
@bja888: Just because you don't like something doesn't mean that it is the best way to do it. I agree with Ooble. Here's an example:
Person A likes looking at his fingers while he types, and averages 20wpm. He doesn't like not looking at his fingers, because then he averages 2wpm with a lot of errors.
Person B likes looking at the monitor while he types, and averages 50wpm.

Just because person a likes looking at his hands doesn't mean it's the best/most effecient way of typing.
nindoja is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:13 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC