Re: Writing non-perl Parsers

"Jason Long" <[email protected]> Wed, 02 Jun 2004 16:25:38 -0400
Newsgroups gmane.comp.sysutils.cfg.devel
Message-ID <[email protected]>
Hmmm... where did you find that example? I ask because I vaguely remember
seeing that or writing that at one time but I don't remember anymore where
it was. In any case I don't think there's any code that actually uses it. If
there is, it probably ignores the type attribute and just ignores perl. The
idea is that at some future point the system would handle a multitude of
different languages.

At any rate, it's been a while since I've worked on the XML-based stuff so
my memory is fuzzy. Lately my parsers have been in the form of WBEM
providers written in Perl. In this case, the WBEM server is responsible for
invoking the parsers, so the parsers can be in any language supported by the
WBEM server. The OpenWBEM server (which I use) supports C++ natively, and
Perl through an interface layer I wrote.

My hope is that the WBEM standards (see
http://www.dmtf.org/standards/wbem/) will eventually become a common way to
manage all sorts of computer systems (including GNU/Linux).

Jason Long



>>> cogumbreiro-bcihRdKnBVXand0/[email protected] 5/30/04 8:09:19 AM >>>
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 
_______________________________________________
Config4gnu-developer mailing list
Config4gnu-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org 
https://lists.sourceforge.net/lists/listinfo/config4gnu-developer


-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504