Re: Why do you use XML?
- From: "jehugaleahsa@xxxxxxxxx" <jehugaleahsa@xxxxxxxxx>
- Date: Fri, 8 Feb 2008 07:15:35 -0800 (PST)
On Feb 8, 12:40 am, Jon Skeet [C# MVP] <sk...@xxxxxxxxx> wrote:
jehugalea...@xxxxxxxxx <jehugalea...@xxxxxxxxx> wrote:
<snip>
What do you think?
I think it's a good idea to use the right format for the job, but XML
has significant benefits in many places:
1) Reasonable character encoding support
How often is this a real concern? I assume you are talking about
Unicode, UTF8, etc. How hard is it to generate a Unicode file? How
often can't you figure that out?
2) No need to manually escape and unescape data (did your SSV file have
no values with spaces in?)
SSV files don't care where the spaces are. The position and length of
fields are static. XML doesn't need to limit the size of a field,
however, neither does CSV. A quick regular expression can break a CSV
file apart in no time (it is slower though).
3) Natural way of representing hierarchies, or multiple tables etc -
SSV/CSV really only describes a single rectangular table easily
I agree this is a good use of XML. However, a long time ago, you
handled heirarchies with a relational schema and had the entities in
separate files, searching on index(which was the line number usually),
which was typically fast and easy to code to.
4) Reasonably self-descriptive, with element and attribute names
I agree about this too. However, again, most other formats support a
header line that has the name of the column. Usually that is all that
is needed. Using my example above, attributes translate to values and
child elements to relations. It can be equally represented.
5) Well-defined standard - if you give me an XML file, I need to
ask you enough information to *understand* the data, but I don't
need more information in order to *load* it. Compare that with
finding out which particular brand of SSV/CSV/etc you're using
This is another good point. Again, even XML formats are typically
application specific, not global such as XHTML. To some degree the
developer must always know what he is working with. In my opinion, it
takes as long to understand a SSV as it does to understand an XML. DTD
surely helps and having the nesting direclty in the file is also
beneficial.
But what experiences have you found XML useful in. I mostly concerned
with knowing a good time to use XML. Like I said, I hear the hype all
the time, but have rarely found a practical application of it.
--
Jon Skeet - <sk...@xxxxxxxxx>http://www.pobox.com/~skeet ; Blog:http://www.msmvps.com/jon.skeet
World class .NET training in the UK:http://iterativetraining.co.uk
.
- Follow-Ups:
- Re: Why do you use XML?
- From: Jon Skeet [C# MVP]
- Re: Why do you use XML?
- References:
- Why do you use XML?
- From: jehugaleahsa@xxxxxxxxx
- Re: Why do you use XML?
- From: Jon Skeet [C# MVP]
- Why do you use XML?
- Prev by Date: Re: asp.net1.1 threading problem
- Next by Date: Re: OOP object collections
- Previous by thread: Re: Why do you use XML?
- Next by thread: Re: Why do you use XML?
- Index(es):
Relevant Pages
|
Loading