Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - Is XML right for this?

 
Thread Tools Search this Thread
Old 07-01-2007, 05:31 PM   #1
Default Is XML right for this?


Appologies for the basic XML question...

I have some sales transaction data that is being generated from
various sources. This is aggregated in a file every day and uploaded
to a server. Then, the data is supposed to be fetched from the
individual files and dumped in to a database (in to a single table).
The data in the files is uniform for every record (i.e. date, time,
price, item, code, etc.). Nothing fancy.

I have the following questions regarding use of XML for these files:

1. Basically this data could as easily be stored in a delimited flat-
file (as it is now). So what is the advantage in using XML in this
case? (I know the advantages of XML in general, but in this case where
the data never changes, I am not sure of the advantage). Actually, the
XML markup bloats the file making transfer time more...

2. Should a DTD be used? A XML Schema? Or no need for this. I am
asking this because suppose in the future some new information is
added to the records, I think the processing script would need to know
what version of the XML file is being used and process accordingly?

3. Should every record in the data be stores as a single node with
data as attributes? (see example below). I think this is an age old
dilemma in XML but not sure of the answer...

4. Does the use of XML make the task of dumping the records in to the
database easier? (I think that either using existing classes or
available utilities there is no real effort in doing this?)

5. Should any type of XML transformation be considered? (or when...)

Sample flat file data:
TNo, Date, Time, Price, Qty
100, 010107, 1020, 3.2, 7

Should XML look like this?
<record TNo="100" Date="010107" Time="1020" Price="3.2" Qty="7"></
record>

Or like this?
<record>
<Tno>100</TNo>
<Date>010107</Date>
<Time>1020</Time>
<Price>3.2</Price>
<Qty>7</Qty>
</record>



ElderUberGeek
  Reply With Quote
Old 07-01-2007, 07:44 PM   #2
=?UTF-8?B?SsO8cmdlbiBLYWhycw==?=
 
Posts: n/a
Default Re: Is XML right for this?
ElderUberGeek wrote:

> 1. Basically this data could as easily be stored in a delimited flat-
> file (as it is now). So what is the advantage in using XML in this
> case? (I know the advantages of XML in general, but in this case where
> the data never changes, I am not sure of the advantage). Actually, the
> XML markup bloats the file making transfer time more...


Yes, the markup is annoying if you are used to
delimited flat files. Are there any chinese characters
in the data ? Are their currency symbols like € ?
Then XML has the advantage that handling Unicode characters
is clearly defined.

> 2. Should a DTD be used? A XML Schema? Or no need for this. I am
> asking this because suppose in the future some new information is
> added to the records, I think the processing script would need to know
> what version of the XML file is being used and process accordingly?


DTD is more standard, but restricted in what it can specify.
Schema is not quite as standard as DTD, but more powerful
in what it can specify.

> 3. Should every record in the data be stores as a single node with
> data as attributes? (see example below). I think this is an age old
> dilemma in XML but not sure of the answer...


Yes it is an old problem. Date, Time, Price, Qty are simple
enough to be stored in attributes. But article descriptions
may be better placed into the node's text.

> Should XML look like this?
> <record TNo="100" Date="010107" Time="1020" Price="3.2" Qty="7"></
> record>


Yes.

> Or like this?
> <record>
> <Tno>100</TNo>
> <Date>010107</Date>
> <Time>1020</Time>
> <Price>3.2</Price>
> <Qty>7</Qty>
> </record>


If the tool you are using can handle this easily,
you shouldnt worry too much.



=?UTF-8?B?SsO8cmdlbiBLYWhycw==?=
  Reply With Quote
Old 07-02-2007, 09:26 AM   #3
Andy Dingley
 
Posts: n/a
Default Re: Is XML right for this?
On 1 Jul, 17:31, ElderUberGeek <aribl...@gmail.com> wrote:

> I have some sales transaction data that is being generated from
> various sources. This is aggregated in a file every day and uploaded
> to a server.


When I do this, I tend to use either RSS or Atom (I'd suggest Atom for
new work). They're both XML, it's just that they've already defined
much of the DTD/Schema I need. With RSS / Atom + Dublin Core I find
that I can solve many of my similar problems without needing to write
any (or much) new code.



Andy Dingley
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46