Re: Why do you use XML?



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

.



Relevant Pages

  • Re: Microsoft Word as competition for LaTeX
    ... LaTeX with larger workflows for scholarly publishing in a ... XML formats will be increasingly more ... the TeX scene one way or another (actually it's already here: ...
    (comp.text.tex)
  • Re: Read binary data file
    ... I think its use is quite industry-dependent: I've never seen it used in financial messaging (that's more likely to use SWIFT formats, which are tagged text) but its common in the telecommunications industry. ... Compared with XML its a LOT more compact (tags are one byte, fixed length fields don't have terminators, variable length fields are preceded by a one or two byte length) and it has a number of predefined field types as well as arrays. ...
    (comp.lang.java.programmer)
  • Re: Why do you use XML?
    ... has significant benefits in many places: ... How hard is it to generate a Unicode file? ... I agree this is a good use of XML. ... even XML formats are typically ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: impl a collection
    ... My objection is more from experience with opaque formats than anything ... In my experience, and in the files I have seen, most people doing XML ... There are exceptions, such as Microsoft's file formats, and some I have ... the wire and on the disk without needing any collusion by the developers ...
    (comp.lang.java.programmer)
  • Re: SQL in the base system
    ... does int32 turn into on a platform with 40 bit words and 20 bit ... a bunch of one-of file formats for each and every purpose. ... Settling on XML ... I agree that validation in XML is a strong point - but one of the reason ...
    (freebsd-hackers)

Loading