The Artima Developer Community
Sponsored Link

Java Community News
Brett McLaughlin: What is XML Really Good For?

81 replies on 6 pages. Most recent reply: Mar 8, 2007 3:37 AM by Antti Tuomi

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 81 replies on 6 pages [ « | 1 2 3 4 5 6 | » ]
robert young

Posts: 361
Nickname: funbunny
Registered: Sep, 2003

Re: Brett McLaughlin: What is XML Really Good For? Posted: Feb 24, 2007 3:17 PM
Reply to this message Reply
Advertisement
> /* It is good for encoding data that is complex enough to
> require a context-free grammar to understand, but which is
> not so often hand-coded that it's worth applying compiler
> technology such as lex and yacc.
> */
>
> OK, so that was a few posts back. Anyhow, XML seems to be
> most useful in keeping people from coming up with file
> formats without considering trouble that may crop up down
> the road (for instance, basing a format on XML makes it
> much easier to add versioning information next release
> when you realize you overlooked that part).

But, except for a syntax convention, XML is "file formats". You always have to write a specific YourProgram to process YourXML. And you need the parser, yada, in front of YourProgram.

>
> To the extent that XML reduces the number of hand-rolled
> file formats out there, the better. To the extent that
> it's used in applications like Ant's build files, well I'm
> not impressed with those applications.

Noted. Duncan got so disgusted with what happened, he does Mac/Ruby now.

Roland Pibinger

Posts: 93
Nickname: rp123
Registered: Jan, 2006

Re: Brett McLaughlin: What is XML Really Good For? Posted: Feb 25, 2007 5:28 AM
Reply to this message Reply
> XML is for documents. Why everybody wants to stuff all
> data into text documents nowadays is beyond my
> comprehension.

Search for 'document centric vs. data centric XML'.

David Chazin

Posts: 4
Nickname: dchazin
Registered: Nov, 2003

Re: Brett McLaughlin: What is XML Really Good For? Posted: Feb 25, 2007 7:09 PM
Reply to this message Reply
XML is good for expressing structured data especially when used in conjunction with xml schema. Is it perfect, no? But it does not require you to reinvent the wheel every time you need to create data. It has a very rich toolset for Validation (SAX/DOM), transformation and manipulation (XSLT and XPath) a decent query language (XQuery), and has built in support in just about every programming laguage.
Also if your schema is well thought out it is quite readable. It's verbose, but so what given the speed of todays processors and networks. The confusion of when to use attributes vs. elements is unfortunate, but is easy to avoid, just don't use attributes.

David Chazin

ERK

Posts: 10
Nickname: erk
Registered: Dec, 2004

Re: Brett McLaughlin: What is XML Really Good For? Posted: Feb 26, 2007 9:09 AM
Reply to this message Reply
Just a test of formatting, since Preview doesn't show what I expect.
<blockquote>
Something quoted...
</blockquote>
End of formatting test.

Gregor Zeitlinger

Posts: 108
Nickname: gregor
Registered: Aug, 2005

Re: Brett McLaughlin: What is XML Really Good For? Posted: Feb 28, 2007 10:33 PM
Reply to this message Reply
> Now if you are saying that you XML is a bad choice for
> configuration, DSLs, etc., I agree completely.
XML is an excellent language for DSLs!

I have designed two XML DSLs (for printer layouts and for filling an SQL database with initial data) and enhanced a third (GUI).

One of them even has logic (<if>, <not>, <and>, and <or>), and this is also very pleasant to read.

If you have a schema-aware editor, you even have auto-completion - I would be surprised if this was available for XML alternatives.

As for attributes vs. character data: always use attributes (unless you have a "markup" document, of course). Not only is that consistent, but it also avoids unnecessary verbosity (because you don't need a closing tag.

This doesn't mean that you should always you XML for DSLs.
Mostly, I use properties files - but when those are not sufficient, XML is the logical next step.

Andy Dent

Posts: 165
Nickname: andydent
Registered: Nov, 2005

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 1, 2007 8:39 PM
Reply to this message Reply
> Most data in the world is not, upon analysis,
> hierarchical.

XML is not inherently hierarchical either.


id=123

ref=123

Gregor Zeitlinger

Posts: 108
Nickname: gregor
Registered: Aug, 2005

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 2, 2007 1:14 AM
Reply to this message Reply
> > Most data in the world is not, upon analysis,
> > hierarchical.
that may be true - but it is also semi-structured, i.e. incomplete - a fact that is natually modelled in XML (missing child elements or attributes). In contrast, this is hard or impossible to model in SQL (it can be somewhat modelled using many joins)

ERK

Posts: 10
Nickname: erk
Registered: Dec, 2004

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 2, 2007 6:00 AM
Reply to this message Reply
What is XML good for? Nothing I've found yet.

Ivan Lazarte wrote:
> Data, and describing data obviously. I believe its met its goal very well.

That wasn't its goal, and it doesn't do it well anyway. Relations are a better abstract description of data, although the mainstream SQL is a poor relational language. XML "describes," if anything, trees, and it does that rather poorly too - for example, contrast with Lisp's s-expressions. Superimposing REF and IDREF atop the tree accomplishes only obfuscation.

XML has lots of parsers - so what? Parsing is well-understood, and tools like JavaCC make generating parsers fairly trivial. You still need to write the logic to build whatever internal structures you require, or use a mapping framework which imposes some restrictions on the data structures you can have.


*** V.H.Indukumar wrote:
> It seems that most people cannot get over the fact that XML is verbose. So what?
> It does not stop me from doing interesting things with it."

Perhaps we should just roll ourselves back to using machine code (not that newfangled assembly!) to read and write files byte-by-byte, the way God intended! Or do you really believe that COBOL is just as good a language as, say, Lisp or Java?

> It has namespace support, it has SAX, it has DOM, both of which are well known standards.

So XML is good because it enables XML-processing technologies? Oooh!

> it has XPath,

So XML is good because it enables XML-processing technologies? Oooh!

> it has extensive editor support, it has DTD/XSD,

So XML is good because it enables XML-processing technologies? Oooh!

> it is simple to read (verbose, but simple),

The word "simple" requires some context, and XML requires the same advice about being "simple", advice Dean Wormer gave Flounder in "Animal House": "Fat, drunk, and stupid is no way to go through life, son."

> it is understood by a large amount of people, and most important of all, it is supported in virtually all environments.

So the popularity contest wins again?

> What more do you want? Give me a data format that has all these features and then
> I will switch! Until then, I will suffer the verbosity of XML gladly.

XML: it's got it all, thus an evolutionary dead-end. No need to think about these matters any further, I guess.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 2, 2007 6:51 AM
Reply to this message Reply
> > it is understood by a large amount of people, and most
> important of all, it is supported in virtually all
> environments.
>
> So the popularity contest wins again?

Why are we having this conversation in English. Do you believe it is because English is the best language?

ERK

Posts: 10
Nickname: erk
Registered: Dec, 2004

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 2, 2007 7:01 AM
Reply to this message Reply
> Why are we having this conversation in English. Do you
> believe it is because English is the best language?

No, but then again human cultural evolution is a vastly different domain from software design. The purposes are different, the role of innovation and design is different, the scope and impact of change is different, etc.

Anthropomorphizing software is a popular tactic with no real value.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 2, 2007 7:07 AM
Reply to this message Reply
> > Now if you are saying that you XML is a bad choice for
> > configuration, DSLs, etc., I agree completely.
> XML is an excellent language for DSLs!
>
> I have designed two XML DSLs (for printer layouts and for
> filling an SQL database with initial data) and enhanced a
> third (GUI).
>
> One of them even has logic (<if>, <not>, <and>, and <or>),
> and this is also very pleasant to read.

Suppose there was a standard equivalent to XML with the following exceptions:

Nodes cannot contain text and elements (no mixed content)
The syntax is changed in the following way:

<parent name="bill" type="father">
<child name="junior" type="son"/>
</parent>

becomes:

parent: name="bill" type="father"
child: name="junior" type="son"


Note that the newlines and indentation are syntactically significant ala Python.

Would you agree that this would be easier for human consumption?

I imaging your DSL would look something like this in the new syntax:

if:
eval: age<18
then:
minor: true

as opposed to:

<if>
<eval>age<18</eval>
<then>
<minor>true</minor>
</then>
</if>


My personal preference is for the first one.

> If you have a schema-aware editor, you even have
> auto-completion - I would be surprised if this was
> available for XML alternatives.

I hadn't considered that. It's true that this can be helpful.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 2, 2007 7:15 AM
Reply to this message Reply
> > Why are we having this conversation in English. Do you
> > believe it is because English is the best language?
>
> No, but then again human cultural evolution is a vastly
> different domain from software design.

What does having this conversation in English have to do with human cultural evolution? It's a language choice. How the language came to be is irrelevant just as it is in the conversation about XML. I guarantee you that many people on these forums are not native English speakers. But the converse in English on these forums. Why do you think that is?

> The purposes are
> different, the role of innovation and design is different,
> the scope and impact of change is different, etc.

Software is a human creation.

> Anthropomorphizing software is a popular tactic with no
> real value.

I'm not anthropomorphizing anything. I asked a question. Disabuse yourself of the notion that you know what I thinking. You are arguing with a figment of your own imagination.

Why do we choose to converse in English and not one of the other hundreds of other languages we could use? If it's not because English is the best language to converse in, what is the reason? It's a simple question.

ERK

Posts: 10
Nickname: erk
Registered: Dec, 2004

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 2, 2007 7:35 AM
Reply to this message Reply
> > > Why are we having this conversation in English. Do
> you
> > > believe it is because English is the best language?
> What does having this conversation in English have to do
> with human cultural evolution? It's a language choice.

Language selection is a choice. The criteria for selection are different, as are the means by which the choices become available. Human languages have much great inertia, for obvious reasons, and computer languages have requirements beyond those of human languages.

> How the language came to be is irrelevant just as it is
> s in the conversation about XML.

No, it's not. To say that is to assume none of us have any choice at all other than to select one of the existing languages. If that were true, we would be writing machine code using a binary wire protocol.

> But the converse in English on these forums.
> Why do you think that is?

Commonality, based primarily on popularity, based primarily on economics.

> Software is a human creation.

One far more explicit and conscious than a human language, which is more organic, evolved over eons. With the exception of Esperanto, of course.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 2, 2007 8:07 AM
Reply to this message Reply
> > > > Why are we having this conversation in English. Do
> > you
> > > > believe it is because English is the best language?
> > What does having this conversation in English have to
> do
> > with human cultural evolution? It's a language choice.
>
> Language selection is a choice. The criteria for selection
> are different, as are the means by which the choices
> become available. Human languages have much great inertia,
> for obvious reasons, and computer languages have
> requirements beyond those of human languages.

This still has nothing to do with the question I asked. Why are we conversing in English and not some other language? Do you not know the answer?

> > How the language came to be is irrelevant just as it is
> > s in the conversation about XML.
>
> No, it's not. To say that is to assume none of us have any
> choice at all other than to select one of the existing
> languages. If that were true, we would be writing machine
> code using a binary wire protocol.

This is redirection. It's has nothing to do with the question I asked. It is in fact also false. As you mention Esperanto was designed. You could design a spoken language and start communicating in it, could you not?

> > But the converse in English on these forums.
> > Why do you think that is?
>
> Commonality, based primarily on popularity, based
> primarily on economics.

But you have suggested that popularity is not a valid choice for choosing which language to communicate with. Should we reconsider which language to communicate in on these fora? Maybe we should create a new language. Natural languages tend to be imprecise.

> > Software is a human creation.
>
> One far more explicit and conscious than a human language,
> which is more organic, evolved over eons. With the
> exception of Esperanto, of course.

You don't think programming languages have evolved? That's demonstrably false. Computer languages have a ancestry that includes 18th century looms.

---

Are you suggesting that if I want to create a B2B service for placing an order at a wholesaler, that I should create a new language to do so?

ERK

Posts: 10
Nickname: erk
Registered: Dec, 2004

Re: Brett McLaughlin: What is XML Really Good For? Posted: Mar 2, 2007 8:29 AM
Reply to this message Reply
> This still has nothing to do with the question I asked.
> Why are we conversing in English and not some other
> language? Do you not know the answer?

I answered it below. However, since you seem to just love this dance, why don't you just rephrase and answer your own question: why are we conversing in English? I responded in English because I know English and because the earlier posts were all in English.

> > No, it's not. To say that is to assume none of us have
> any
> > choice at all other than to select one of the existing
> > languages. If that were true, we would be writing
> machine
> > code using a binary wire protocol.
>
> This is redirection. It's has nothing to do with the
> question I asked. It is in fact also false.

Since you seem to enjoy repeatedly stating that I'm drifting off-topic, I'll drop this, as indeed I'm about to do with the entire conversation. If your purpose was to teach, you're failing; if your purpose was to exhaust me, you're succeeding.

> As you
> mention Esperanto was designed. You could design a spoken
> language and start communicating in it, could you not?

No - communicating with whom? Human languages are only useful to the extent that the participants understand them. Computer languages share that aspect with human languages, but the participants are not only easier to teach, but distributable and capable of being provided, cheaply, by third parties.

> > Commonality, based primarily on popularity, based
> > primarily on economics.
>
> But you have suggested that popularity is not a valid
> choice for choosing which language to communicate with.

I didn't suggest that for the general case of "languages." I suggested it was far less important for computer languages than for human ones.

> Should we reconsider which language to communicate in on
> n these fora? Maybe we should create a new language.
> Natural languages tend to be imprecise.

The point is irrelevant, since the conversations on these fora aren't between components of systems.

> > > Software is a human creation.
> >
> > One far more explicit and conscious than a human
> language,
> > which is more organic, evolved over eons. With the
> > exception of Esperanto, of course.
>
> You don't think programming languages have evolved?
> That's demonstrably false. Computer languages have a
> a ancestry that includes 18th century looms.

I didn't say that. Read again. I said human language evolves in a more organic (read: so complex as to be unplannable) fashion, and that computer languages are more explicitly designed, and consciously changed. Ancestry is irrelevant; computer languages are designed explicitly. They don't have DNA, except to the extent that the designer(s) insert it.

> Are you suggesting that if I want to create a B2B service
> for placing an order at a wholesaler, that I should create
> a new language to do so?

Possibly. It depends on the service and the wholesaler, and on the availability of existing interfaces and languages for same. Are you suggesting that XML is a valid language on its own? It's not.

Flat View: This topic has 81 replies on 6 pages [ « | 1  2  3  4  5  6 | » ]
Topic: Martin Fowler Takes ANTLR for a Test Drive Previous Topic   Next Topic Topic: Desklets for Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use