Re: [xml] s-exprs

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Wed Jan 26 2000 - 04:34:49 EST


On Wed, Jan 26, 2000 at 10:12:10AM +0100, pj@walter-graphtek.com wrote:
>
> Hi Daniel, hi all,
>
> This may score for the strangest feature request you've got, but I
> would like to use libxml for parsing and (probably transcoding to
> XML) configuration data in s-expr syntax.
>
> Perhaps anyone has an idea how to plug an existing s-expr parser
> into libxml?
>
> The desired functionality, would be reading something like
>
> (foo (bar x y z) hu fu 'gnu)
>
> application transparently as it were encoded as
>
> <foo><bar><x/><y/><z/></bar><hu/><fu/>gnu</foo>

  Hi Peter,

 Well shouldn't be a PhD thesis problem :-)
The code sequence needed is :

  doc = xmlNewDoc("1.0");

  doc->root = parseSExpr(doc, "(foo (bar x y z) hu fu 'gnu)")

and parseSExpr is recursive , calling

  node = xmlNewDocNode(doc, NULL, name, NULL);

on the first item and

  xmlNewChild(node, NULL, childname, NULL)

for the following ones and recursing on (

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:29:59 EDT