Ruby, XML schema( RELAX NG) and a Q&D parser


#1

In article 3cf7b339@news.mhogaming.com,

    • I guess I didn’t explain very well. I don’t want a general
      purpose XML parser. I want one that only groks the messages
      of the protocol. I want to use a general Purpose xml parser
      to write the code for the special purpose XML parser. Sort
      of like using lex and yacc.

I don’t think that you’ll gain much in speed, especially for the effort
involved.

    • You’re right I should test with Expat first. I have written
      parsers for other protocols than require a lot less code than
      any XML parser I’ve seen. XML only LOOKS simple.

However, you could probably generate a parser with Rockit, although getting
the output turned into C might be a chore.

    • Basically, I need to go from C struct to XML and back.
      It would be best if all the code to do this were in C.
      I’d like to use Ruby to write that code from the RELAX
      NG description of the XML.

Ah. Ok. Well, this is a topic beyond my interest and expertise.

    • I think for a first pass, I’m just going to try to get the
      C struct headers written from the RELAX NG schema descriptions.
      It’s looking like full RELAX ng is too complicated for what I
      want to do. I think XML would be much more useful if the design
      committees had to play Russian Roulette with an extra bullet
      for every new feature. Deleting an existing feature would
      allow you to take bullets out the gun %-).
    • Booker C. Bense
···

Sean Russell ser@germane-software.com wrote:

bbense+comp.lang.ruby.May.31.02@telemark.stanford.edu wrote:


(SER) #2

Well, remember where XML came from: SGML. If you think XML is hairy, take a
look at history. I think they did OK with XML, although namespaces suck.
XMLSchema has gone the way of SGML: it is /vastly/ better than DTD, but
they could have done 80% of what they wanted to with 20% of the cruft.

If you want an absurdly simple metadata format, take a look at Pyx. It
isn’t a standard, and documentation about it is really scarce, but it
doesn’t need much documentation because it is a trivial format (about as
trivial as you can get and still have document structure). I’ve done a Pyx
parser in Ruby and Java, and some XML<->Pyx converters (which I haven’t
released yet); that, and some information on Pyx is at:

    http://www.germane-software.com/software/Pyx

You don’t really need a parser for Pyx, though. You can grep it.

···

bbense+comp.lang.ruby.Jun.01.02@telemark.stanford.edu wrote:

    • I think for a first pass, I’m just going to try to get the
      C struct headers written from the RELAX NG schema descriptions.
      It’s looking like full RELAX ng is too complicated for what I
      want to do. I think XML would be much more useful if the design
      committees had to play Russian Roulette with an extra bullet
      for every new feature. Deleting an existing feature would
      allow you to take bullets out the gun %-).

… “We’re lucky we don’t get all the government we pay for.”
<|> – anon
/|\
/|