pros/cons of using XML in Unix

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Childs

Lifer
Jul 9, 2000
11,313
7
81
Originally posted by: kamper
Originally posted by: BingBongWongFooey
xml isn't really meant for human viewing/editing. If the job requires either, then xml is probably a bad choice. Look how damn noisy that CFMX config file is! No sane person would want to type all that crap by hand.

(although it is tempting for programmers: parsers are such an annoyance to write)

I beg to differ (sheesh, I'm arguing with everyone today :roll: )

Another important part of xml is that it sits nicely in between an ideal computer format and an ideal human readable format. If it was never meant to be read by humans it would probably be binary and not nearly so verbose. I have no trouble reading the posted xml file, perhaps because I'm used to it.

Get a decent xml editor and you get things like automatic tag closure (type "<foo>" and it appends "</foo>"), automatic formatting (because, of course, white space and nesting are of the utmost importance for human readablility) and syntax highlighting. Syntax highlighting is especially handy when the editor can find the dtd or xsd, parse your xml file and tell you when you've created an invalid document and why.

It's the same as editing source code in any programming language. It's a compromise between straight up english and straight up binary.

But I believe n0c's point was that config files in a unix env is not the place for XML, and I tend to agree. I deal with XML config files for some Mac stuff, and its irritating. Having <foo> value </foo> instead of foo=value is retarded, and when you're looking at the files remotely in something like vi it just gets in the way. The indentations don't help either. Maybe if you used a fancy editor with colors and what not it may be easier to read, but admins often do not use such tools.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
I'm not a unix admin. Nor are most folks who edit web.xml.

Originally posted by: kamper
You can use what you like and I'll use what I like and the world will be a happier place for it. :)

I should have kept my mouth shut after saying that. :p

*shuts mouth and crosses fingers, hoping he'll have the self control this time*
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: kamper
I'm not a unix admin. Nor are most folks who edit web.xml.

Originally posted by: kamper
You can use what you like and I'll use what I like and the world will be a happier place for it. :)

I should have kept my mouth shut after saying that. :p

*shuts mouth and crosses fingers, hoping he'll have the self control this time*

Discussion is what makes web forums worth while. ;)
 

Childs

Lifer
Jul 9, 2000
11,313
7
81
Originally posted by: kamper
I'm not a unix admin. Nor are most folks who edit web.xml.

Originally posted by: kamper
You can use what you like and I'll use what I like and the world will be a happier place for it. :)

I should have kept my mouth shut after saying that. :p

*shuts mouth and crosses fingers, hoping he'll have the self control this time*

I'm not just talking about web.xml. XML is sneaking into config files everywhere, and theres no need for it.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: kamper
Originally posted by: BingBongWongFooey
xml isn't really meant for human viewing/editing. If the job requires either, then xml is probably a bad choice. Look how damn noisy that CFMX config file is! No sane person would want to type all that crap by hand.

(although it is tempting for programmers: parsers are such an annoyance to write)

I beg to differ (sheesh, I'm arguing with everyone today :roll: )

Another important part of xml is that it sits nicely in between an ideal computer format and an ideal human readable format. If it was never meant to be read by humans it would probably be binary and not nearly so verbose. I have no trouble reading the posted xml file, perhaps because I'm used to it.

Get a decent xml editor and you get things like automatic tag closure (type "<foo>" and it appends "</foo>"), automatic formatting (because, of course, white space and nesting are of the utmost importance for human readablility) and syntax highlighting. Syntax highlighting is especially handy when the editor can find the dtd or xsd, parse your xml file and tell you when you've created an invalid document and why.

It's the same as editing source code in any programming language. It's a compromise between straight up english and straight up binary.

But the whole idea of XML is that apps can share data. XML is great for a document markup language, so that say, a bunch of different editors can easily support some document format -- they can all just use XML libraries instead of having to rewrite a parser (although of course a parser is only part of the work).

If you have a config file, generally it is used by two things: 1) the app, 2) the user, when editing it. In this case, why does it make any more sense to use XML than to use something like yaml, which is much easier for humans to read/write? YAML makes it much easier on the human, and the application has roughly the same ease of accessing the structured data. Why over-burden the user for no reason?

My point: things like xml -- formal structured data markup languages with good library support -- are generally a good thing, but xml itself is often not the best.