Boost logo

Boost :

Subject: Re: [boost] New XML library
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2008-12-10 16:23:05


Themis Vassiliadis wrote:
> I have been working in a C++ library like Apache Digester
> (http://commons.apache.org/digester). I'm intending to convert it
> following boost policies described in Requirements and Guidelines.
>
> What are the chances of it become a Boost library ?

Personally I would like to see something like RapidXML in Boost.

It seems that Apache Digester provides an element matching
infrastructure. This could be useful, as manually iterating through
the parse tree that something like RapidXML generates can be a bit
tiresome. It should probably be layered on top of a lower-level XML parser.

I have found this example at
http://www.javaworld.com/javaworld/jw-10-2002/jw-1025-opensourceprofile.html?page=2
:

public class SampleDigester
{
   public void run() throws IOException, SAXException
   {
     Digester digester = new Digester();
     // This method pushes this (SampleDigester) class to the Digesters
     // object stack making its methods available to processing rules.
     digester.push(this);
     // This set of rules calls the addDataSource method and passes
     // in five parameters to the method.
     digester.addCallMethod("datasources/datasource", "addDataSource", 5);
     digester.addCallParam("datasources/datasource/name", 0);
     digester.addCallParam("datasources/datasource/driver", 1);
     digester.addCallParam("datasources/datasource/url", 2);
     digester.addCallParam("datasources/datasource/username", 3);
     digester.addCallParam("datasources/datasource/password", 4);

     // This method starts the parsing of the document.
     digester.parse("datasource.xml");
   }
   // Example method called by Digester.
   public void addDataSource(String name,
                             String driver,
                             String url,
                             String userName,
                             String password)
   {
     // create DataSource and add to collection...
   }
}

It parses XML like this:

<datasources>
   <datasource>
     <name>HsqlDataSource</name>
     <driver>org.hsqldb.jdbcDriver</driver>
     <url>jdbc:hsqldb:hsql://localhost</url>
     <username>sa</username>
     <password></password>
   </datasource>
....

This seems to be worthwhile, but I would like to think that we could
improve on the details. In particular the positional-parameter
numbering looks a bit clunky and it would be nice to avoid run-time
parsing of the pattern expressions. I also note that the patterns look
like xpath epressions, but aren't.

Please tell us more about your proposal.

Cheers, Phil.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk