is there any lib used to parse XML file in boost?
hello, i need a simple xml prasing library, i consider there should be some in boost lib but i can't find it or document for this, help!
The Spirit library has XML parsing capability since the boost::serialization library uses Spirit for XML parsing. I am not familiar with Spirit but my recommendation for an easy to use, portable and fast XML library is Expat <http://expat.sourceforge.net> (not related to Boost). -delfin
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of lanser Sent: Sunday, April 16, 2006 8:38 PM To: boost-users@lists.boost.org Subject: [Boost-users] is there any lib used to parse XML file in boost?
hello, i need a simple xml prasing library, i consider there should be some in boost lib but i can't find it or document for this, help! _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi ... or you can use libxml (http://xmlsoft.org), which is also portable. I used it on Windows and Linux. It is a C library. Catalin On 4/17/06, lanser <shizhensong@gmail.com> wrote:
hello, i need a simple xml prasing library, i consider there should be some in boost lib but i can't find it or document for this, help! _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
... or you can use libxml (http://xmlsoft.org), which is also portable. I used it on Windows and Linux. It is a C library.
There are further advantages to using libxml. The programming model of expat is based on the SAX2 interface. Libxml has both the SAX2 and a pull-parser interface, which is generally easier to use from an application point of view. Libxml2 is generaly faster than expat. It also has better support for all the different XML features such as entities etc. I also believe it's more actively maintained and developed.
thanks to everybody, i'm a fresh man to boost. i found it's hard to search document of variant libraries even i update all by CVS. it seemed different libraries has seperate documents!? does boost has a document or example summary for all her excellent libraries? btw: i just need a simple XML parser to config my software( skin in fact ). i have used Xerces but it seemd too big or heavy. On 4/18/06, Delfin Rojas <drojas@moodlogic.com> wrote:
From: boost-users-bounces@lists.boost.org
<snip>
... Libxml2 is generaly faster than expat.
Is your assessment based on experience? Just curious. I have used expat for several years and I would be really interested if libxml2 can do the job faster.
-delfin
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
lanser wrote:
thanks to everybody, i'm a fresh man to boost. i found it's hard to search document of variant libraries even i update all by CVS. it seemed different libraries has seperate documents!? does boost has a document or example summary for all her excellent libraries?
http://boost.org/libs/libraries.htm
btw: i just need a simple XML parser to config my software( skin in fact ). i have used Xerces but it seemd too big or heavy.
Configuration file usually needs to be modified,saved. XML modification task is a bit simplier when done using DOM parser. IMHO for such purpose like config files TinyXML fits very well. Cheers -- Mateusz Łoskot http://mateusz.loskot.net
On 4/18/06, lanser <shizhensong@gmail.com> wrote:
thanks to everybody, i'm a fresh man to boost. i found it's hard to search document of variant libraries even i update all by CVS. it seemed different libraries has seperate documents!? does boost has a document or example summary for all her excellent libraries?
btw: i just need a simple XML parser to config my software( skin in fact ). i have used Xerces but it seemd too big or heavy.
Take a look at http://sourceforge.net/projects/libjingle, source part of GTalk. There are some class wrap expat well, It's small and fast. Ken
... Libxml2 is generaly faster than expat.
Is your assessment based on experience? Just curious. I have used expat for several years and I would be really interested if libxml2 can do the job faster.
Yes, we test and run a lot of benchmarks on a lot of different XML parsers (including some not generally available). Libxml used to be a touch slower than expat but libxml2 is faster in both the SAX2 mode and when used as a pull parser. Also, there are some new interfaces in libxml2 that allow you to minimize the amount of string copying and allocation, which futher enhances its advantage. Tom
The best wrapper I have ever used for libxml2/libxslt is a lib called xmlwrapp (now in sourceforge). It wraps both libxml and libxslt, provides sax and tree parsers, and has an iterator style interface. There are some possibly "hidden" advantages to using a complete library like xmlwrapp/libxml2 that may not be needed in-the-moment, but downstream can save huge amounts of time. First, most xml parsers only read xml, they have no capability to store and produce xml. At first blush this doesn't seem important, but it is fairly easy to produce invalid xml if your just printf-ing out xml formatted data. Second, libxml2 integrates with libxslt, which gives you access to APIs for applying transforms to in memory xml. This ability (lacking in most libs) can prove invaluable. On 4/18/06, Tomas Puverle <Tomas.Puverle@morganstanley.com> wrote:
... Libxml2 is generaly faster than expat.
Is your assessment based on experience? Just curious. I have used expat for several years and I would be really interested if libxml2 can do the job faster.
Yes, we test and run a lot of benchmarks on a lot of different XML parsers (including some not generally available). Libxml used to be a touch slower than expat but libxml2 is faster in both the SAX2 mode and when used as a pull parser. Also, there are some new interfaces in libxml2 that allow you to minimize the amount of string copying and allocation, which futher enhances its advantage.
Tom
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
If you only need very basic xml (plain elements plus attributes) I have some code at http://dev.int64.org/snips/xml.hpp. No documentation, but hopefully one could decipher how to use it. I use it often to read/write config files. You may want to look at what boost::serialization uses, too. On 4/16/06, lanser <shizhensong@gmail.com> wrote:
hello, i need a simple xml prasing library, i consider there should be some in boost lib but i can't find it or document for this, help! _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Cory Nelson http://www.int64.org
"lanser" <wrote:
hello, i need a simple xml prasing library, i consider there should be some in boost lib but i can't find it or document for this, help!
"Property tree library revision 5 (review version) is now in the boost vault. Documentation can be viewed online at http://kaalus.atspace.com/ptree" The library is planned for review. It is handy for using XML as configuration data. /Pavel
can't open http://kaalus.atspace.com/ptree could anyone paste this page, thanks a lot On 4/17/06, Pavel Vozenilek <pavel_vozenilek@hotmail.com> wrote:
"lanser" <wrote:
hello, i need a simple xml prasing library, i consider there should be some in boost lib but i can't find it or document for this, help!
"Property tree library revision 5 (review version) is now in the boost vault. Documentation can be viewed online at http://kaalus.atspace.com/ptree"
The library is planned for review. It is handy for using XML as configuration data.
/Pavel
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
"lanser" wrote:
can't open http://kaalus.atspace.com/ptree could anyone paste this page, thanks a lot
Hmm, it work for me. Try http://kaalus.atspace.com/ptree/doc/index.html All documentation is also available in ZIP file in Boost.Vault. /Pavel
lanser wrote:
hello, i need a simple xml prasing library, i consider there should be some in boost lib but i can't find it or document for this, help!
Take a look at Daniel Nuffer's example presenting how to parse XML documents using Spirit (at the bottom): http://spirit.sourceforge.net/repository/applications/show_contents.php Second, I'm not sure what XML parser are you looking for: DOM or SAX, so here are my recommendations for both engines: - SAX parser -> Expat http://expat.sourceforge.net/ - DOM parsr -> TinyXML http://www.grinninglizard.com/tinyxmldocs/index.html Both are very portable and quite easy to use. Cheers -- Mateusz Łoskot http://mateusz.loskot.net
lanser wrote :
hello, i need a simple xml prasing library, i consider there should be some in boost lib but i can't find it or document for this, help!
I would advise libxml++. It's a C++ wrapper for libxml2, which is nicier than the original C library. Unlike Xerces, it uses modern C++ with templates and RTTI. Be aware though that it depends on glibmm (which is pretty huge - but you could trim it to what's only needed) for Unicode handling.
participants (10)
-
Catalin Pitis
-
Cory Nelson
-
Delfin Rojas
-
Doug Henry
-
Ken
-
lanser
-
loufoque
-
Mateusz Łoskot
-
Pavel Vozenilek
-
Tomas Puverle