9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David Tolpin <dvd@davidashen.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] OT: DTD to yacc spec?
Date: Thu, 19 Feb 2004 21:19:16 +0400	[thread overview]
Message-ID: <200402191719.i1JHJGKt016069@adat.davidashen.net> (raw)
In-Reply-To: <d2090d153502fe41a9e7e2c2622fb542@tombob.com>

> >
> > I guess I am looking for a tool that can convert a DTD into
> > a good old yacc grammar spec (I would still need to provide
> > actions, though). Does anybody know of such a tool?
>
> Oh, how great it is to know that I'm not alone.  Ever since I have
> been exposed to XML and its parsers have I wondered about their
> weirdness.  They never looked like parsers to me, more like toolkits
> to help write a generic XML editor or display system.
>
> I would absolutely love to have a parser generator that takes a DTD or
> schema and produces a parser to read XML only for that one definition.
> All I have encountered so far are "validating" parsers that seem to
> make XML file interchange even harder, as the DTD or schema has to be
> provided from the outside.

An XML parser is like lex(1), it performs tokenization on the level
of XML. When you want a grammar-driven processing of an XML file,
you can convert DTD to a yacc grammar with awk and use an XML parser
to implement yylex.

Additionally a number of tools exists to generate code from schemata,
such as RelaxNGCC (http://relaxngcc.sourceforge.net/). Since Relaxб═NG
can be generated from DTD by Trang,
http://thaiopensource.com/relaxng/trang.html , it solves your problem.

One of many tools in C which match your description is at
http://flexml.sourceforge.net/ . There are also many others around.

David Tolpin
http://davidashen.net/


  reply	other threads:[~2004-02-19 17:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-19 16:31 kazumi iwane
2004-02-19 17:08 ` plan9
2004-02-19 17:19   ` David Tolpin [this message]
2004-02-19 18:23     ` kazumi iwane
2004-02-19 18:20   ` kazumi iwane
2004-02-20  2:44 ` boyd, rounin
2004-02-19 17:47 Laura Creighton
2004-02-19 18:25 ` kazumi iwane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200402191719.i1JHJGKt016069@adat.davidashen.net \
    --to=dvd@davidashen.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).