[Ometa] XML parser

Rüdiger Plantiko ruediger.plantiko at astrotexte.ch
Fri Aug 13 14:19:32 PDT 2010


Hi Alexandros,

> URI/XML/HTTP thought I'd ask if anyone is aware of OMeta parser efforts
in these areas,

I also found an XML parser an interesting object for learning OMeta. See
my work in progress under

http://ruediger-plantiko.net/ometa

Enter a string to be parsed in the left text field below the grammar, and
hit "Interpretieren (ctrl+2)". You will get a kind of boolean reply -
either you get the error message "match failed" in the message line on top
of the grammar. Or you will get the reply "[Object object]" and no error -
this is the case that the string matched the given rule. The result object
is a structured JSon object that could be processed further. (If you want
to see it live, you can inspect it in the debugger by placing a breakpoint
on line 98 in myOmeta.js).

For example, the string

<?xml version="1.0"?>
<a b="c"><d>e</d>f<g h="i"/></a>

would be parsed with the rule "document" to a JSon object of the form

{ name:"a",
  atts:{b:"c",_length:1},
  content:[
    { name:"d",
      atts:{_length:0},
      content:["e"]
      },
    "f",
    { name:"g",
      atts:{h:"i",_length:1},
      content:[]
      }
  }

I think you get the idea... :-)

And please don't sell it in the web, it's still work in progress :-)

Kind regards,
Rüdiger




~~~~~~~~~~~~~~~~~~~~~~~~
Dr. Rüdiger Plantiko
Bachwiesenstrasse 28
CH-8405 Winterthur-Seen

http://ruediger-plantiko.net







More information about the OMeta mailing list