Writing non-perl Parsers
Tiago Cogumbreiro <cogumbreiro-bcihRdKnBVXand0/[email protected]> Sun, 30 May 2004 12:09:19 +0000
| Newsgroups | gmane.comp.sysutils.cfg.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello all,
I've come across this nifty project just yesterday, and it is exactly
what i thought linux was missing. Congratulations for this very
interesting initiative.
My interest in this projects come in two ways: i want to learn how to
create a non-perl based parser. And then i want to play with Gtk+C or
pygtk with a simple frontend.
What i figured so far is that for creating a parser you create something
like:
<?xml version="1.0"?>
<parser uid="runlevels" type="normal">
<name>Runlevels</name>
<readcommand type="perl"><![CDATA[
use CFGXML::Runlevels;
my $parser = CFGXML::Runlevels->new;
my $doc = $parser->get;
my $xml_pi = $doc->createXMLDecl('1.0');
print $xml_pi->toString;
print $doc->toString;
]]></readcommand>
<writecommand type="perl"><![CDATA[
use CFGXML::Parser::Ini;
my $parser = CFGXML::Parser::Ini->new;
$parser->run("unparse");
]]></writecommand>
<default-configfile>/etc/samba/smb.conf</default-configfile>
</parser>
This seems very clear to me on how it works. But if i want to implement
the parser in another language/method then perl, how do i do it?
Which is the type attribute?
What if it does not a configuration file, is it enforced to use that
tag?
How does the parser speak with the middle layer?
Do you prefer people to write parsers in perl?
Thank you for your time :)
Tiago Cogumbreiro
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click