[antlr-interest] antlr suitable for xml languages? (likebpelandare there existing grammaires)

Martin Probst mail at martin-probst.com
Wed Dec 14 07:34:34 PST 2005


Hi,

> First, I'll discount DOM right away for memory concerns, readability, and
> "missability". Quite simply, you can forget to traverse a child tag...

I concur with Scott, DOM is probably the definite worst-case of a
library. It's complex, unwieldy, unintuitive and doesn't fit any of the
languages implementing it. As an additional bonus it's slow by spec,
e.g. the spec mandates certain behaviours which are impossible to
implement without a major speed & memory impact.

Every user should by all means avoid using DOM if he can. Of course you
could try to implement your parser in one of the many XML languages out
there, e.g. C-omega or E4X, XQuery, XSLT etc, but all of them don't
really seem suitable for that.

However there is a much simpler approach, using XML binding tools like
XML Beans to convert an XML schema into some Java code that will
transform your XML documents into your domain objects. The drawback is
that you'll have to learn XML schema, plus the limitations of XML
schema, but I'd guess it would still be a lot easier.

Martin



More information about the antlr-interest mailing list