Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML vs. Databases

Status
Not open for further replies.

frosty7700

Programmer
Aug 10, 2001
95
0
0
US
I've been using relational databases for a long time now...creating them is second nature to me, including data normalization and what not.

I'm having a HUGE problem wrapping my head around what the heck the point of XML is. It seems grossly unstructured and inefficient to me as a "substitute" to a true database. What, exactly, is its purpose? Surely, for example, I can't effectively store an entire company's order data in what are essentially text files?

The fact that there doesn't seem to be a common standard for moving data from a DB to XML doesn't help me either.

I guess my problem is I pretty much have to learn XML, but I can't find anyone who can explain it to me from the perspective of an experienced database app. developer.

I am totally lost.
 
Hi frosty,

>> as a "substitute" to a true database

it is not a substitute. If u have massive amounts of data u need a database.

>> What, exactly, is its purpose?

As many as u can think of or more appropriately as many as u need.

<excerpt>
Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere.
</excerpt>

>> I pretty much have to learn XML

why? In what context?
-There are only 10 types of people in the world, those who understand binary and those who don't-

-pete
 
I think one of the best examples of XML I have seen are news feeds.

You have a feed, you format it into an XML file and host it on the web, now someone else comes along with a page which reads that and formats it pretty and publishes it on their page.

Or you're a reporter and you want to submit a blurb, you put it into your program which saves it as an XML file properly formatted by the agencies standards and email that away... and with no user intervention it can be launched into the feed or just onto a site.

Sure a database is just as good at doing some of this, but the reporter in the field may not have a way to add that user, and do you want to bother hosting a database with all those feeds for everyone? and do you want to go with Oracle or MSSQL or mySQL etc....

I personally enjoy it for configuration files which are more complex than INI files, but are way too simple for a real dtabase.

I've also employed it for formatting my result sets of queries. Here's the example of that from a couple years ago... Have a real database with tons of info... Boss says we need to setup a page to query that.

Setup the whole page, now I can specifically format those results into HTML or Excel or Ascii or... well shoot, I dunno what he wants, and he's out of the country... dump it to XML, and now it's a trivial point to turn it from that XML file to any of the other formats. To include or exclude specifics parts without ever having to go back to the engine and modify the the SQL statements or deal with the indices.

So in other words... it's not database to me... but it's a great intermediate simple STANDARD... and in its standardization comes its real power.

-Rob
 
So, XML is really more of a tool for the purposes of facilitating...to &quot;pass the buck&quot; of interpretation to whatever is requesting the data in a straightforward manner?

In any event, thanks for the tips. Skiflyer, your newsfeed tip is a nice example. I had heard it before but never explained that thoroughly.

Thanks both of you.

Additional advice is still welcome, of course.
 
Palbano, in response to why I have to learn XML...

It's obviously becoming a very commonly used tool, and I'm one of those people that hates being in the dark on any major &quot;universal&quot; tool or standard, e.g. SQL, HTML. Dunno, I just feel like I need to at least understand XML.
 
ok, the reason i asked was if u have a certain path u need to go down... to try to help in that specific direction.

so just start digging in i think. it's a generic solution so it fits many problems. that gives it a really broad scope and when you add in some of the related technologies (XSLT/XPath/VML...) it gets real big real fast.

some of the old samples on msdn.microsoft.com/xml might be a good starting point because they tend to deal with plain XML and some XSL issues. -There are only 10 types of people in the world, those who understand binary and those who don't-

-pete
 
Heheh...one step ahead of you, skiflyer. I'm already there. I have a decent understanding of the XML syntax for now...it's just the uses of it and the &quot;why's&quot; I'm fuzzy on. How to extract from it/write to it/etc..

If I were to use XML in the near future, I'd likely be trying to place data from a database into XML format, seeing as how most work I'm involved in is web-based apps with a database backend.
 
>> most work I'm involved in is web-based apps with a
>> database backend.

what web server environments?

what databases?

many databases now support XML generation from queries natively.
-There are only 10 types of people in the world, those who understand binary and those who don't-

-pete
 
Let's see...

My weapons of choice are usually IIS and ASP, with SQL Server or, for small stuff, Access.

Occasionally I use Apache with PHP and MySQL.

I'm actually already playing with some ASP code that queries Access data and throws it into an XML doc.
 
later versions of SQL Server support both query and response of XML data through IIS virtual directories. i think u can find samples on the MS SQL Server site. -There are only 10 types of people in the world, those who understand binary and those who don't-

-pete
 
frosty7700,

i'm in the same boat: i understand the syntax of XML, and i've been learning it because of all the hype, but i can't find a valid purpose to use it for so i can really dig in.

my take on it is XML is a good &quot;cross-platform&quot; data structure.

=========================================================
if (!succeed) try();
-jeff
 
Interpret cross-platform openly... it's good for going from one operating system to another because it's plain text. It's good for going from one language to another, because many languages have built in support for it.

-Rob
 
Hi Everyone,
I am trying to read the variables in an Oracle 8 table and create a XML document. What is the easiest way? Or should I create the XML document and store it as a CLOB variable so that I can read that variable and pass it as the XML document. I need it to have a quick response time since the end user information has to be extracted and passed as an XML document to a vendor site.

Any ideas & suggestions is much appreciated.

Thanks in advance
 
>> I need it to have a quick response time since the end
>> user information has to be extracted and passed as an
>> XML document to a vendor site.

If that is the &quot;only&quot; requirement then using the CLOB approach would be better. If you need to query the data in a more traditional SQL based fashion, using column filtering, sorting etc., then no of course.

Using JDBC and the XML DOM in Java it is very simple to generate an XML document in memory from SQL query results.

-pete
 
The easiest way to get Oracle information into XML is to use the built-in packages (assuming you have them installed). For example

Code:
xmlgen.getxml('SELECT * FROM emp');

Will return a CLOB with an XML version of the query results. -- Chris Hunt
Extra Connections Ltd
 
Thanks Chris & Pete. I was referred to an Oracel Metalink document #: 163552.1 that gave me some additional info also. Thanks for responding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top