is there any lib used to parse XML file in boost?

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

is there any lib used to parse XML file in boost?

lanser
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
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Delfin Rojas
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: [hidden email]
> [mailto:[hidden email]] On Behalf Of lanser
> Sent: Sunday, April 16, 2006 8:38 PM
> To: [hidden email]
> 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
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Catalin Pitis
In reply to this post by lanser
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 <[hidden email]> 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
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Cory Nelson
In reply to this post by lanser
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 <[hidden email]> 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
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


--
Cory Nelson
http://www.int64.org
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Pavel Vozenilek
In reply to this post by lanser

"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
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

lanser
can't open    http://kaalus.atspace.com/ptree
could anyone paste this page, thanks a lot

On 4/17/06, Pavel Vozenilek <[hidden email]> 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
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Mateusz Loskot
In reply to this post by lanser
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

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
--
Mateusz Loskot, http://mateusz.loskot.net
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Tomas Puverle
In reply to this post by Catalin Pitis
> ... 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.


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

james.jones
In reply to this post by lanser
>From: Tomas Puverle <[hidden email]>
>> ... 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.

I may just be showing my ignorance here, but how do people feel about Xerces? Especially given that it's written in C++.

(Note: I'm trying to install Xerces now on Solaris, and it isn't easy.)

Ob the original question: Why not just use Boost serialization?

-
James Jones             Administrative Data Mgmt.
(v)732-510-1806         375 Raritan Center Pkwy, Suite A
(f)732-510-1855         Edison, NJ 08837
Visit us on the web at http://www.firstinvestors.com/
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Tomas Puverle
> I may just be showing my ignorance here, but how do people feel about
Xerces? Especially given that it's
> written in C++.

In my experience, the problem is its performance.  In many cases, I've seen it
run 10+ times slower compared to libxml or expat.




_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Mathias Gaunard
In reply to this post by lanser
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.

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Pavel Vozenilek
In reply to this post by lanser

"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




_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Delfin Rojas
In reply to this post by james.jones
> [hidden email] wrote
>
> <snip>
>
> I may just be showing my ignorance here, but how do people
> feel about Xerces? Especially given that it's written in C++.
>
> (Note: I'm trying to install Xerces now on Solaris, and it
> isn't easy.)
>

In my experiencie Xerces is too bulky. For a server environment it may be ok
but for client software it would be overkill when there simpler, smaller and
faster libraries out there like libxml and expat.

-delfin

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Delfin Rojas
In reply to this post by Tomas Puverle
> From: [hidden email]
>
> <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
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

lanser
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 <[hidden email]> wrote:

> > From: [hidden email]
> >
> > <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
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Mateusz Loskot
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
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
--
Mateusz Loskot, http://mateusz.loskot.net
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Ken-37
In reply to this post by lanser
On 4/18/06, lanser <[hidden email]> 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

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Boris Kolpackov-2
In reply to this post by james.jones
Hi James,

<[hidden email]> writes:

> I may just be showing my ignorance here, but how do people feel about
> Xerces? Especially given that it's written in C++.

Here is what I know about Xerces-C++ from experience:

 - Out of all mentioned parsers (expat, libxml2, tinyxml) it is the only
   validating parser that supports both DTD and XML Schema. I think libxml2
   supports only DTD and the other two do not support any validation.

 - Fairly complete support for advanced XML features, e.g., namespaces,
   entity references, CDATA, etc.

 - Extensive support for character encodings.

 - Supports DOM and SAX in one package.

 - C++ API. It is sometimes quite ugly, though.

 - Fairly portable.


> (Note: I'm trying to install Xerces now on Solaris, and it isn't easy.)

I didn't find the installation any more difficult than say... boost ;-).

hth,
-boris


--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open Source Cross-Platform C++ XML Data Binding

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Tomas Puverle
In reply to this post by Delfin Rojas
> > ...  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
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: is there any lib used to parse XML file in boost?

Ovanes Markarian
In reply to this post by Boris Kolpackov-2

On Tue, April 18, 2006 8:59, Boris Kolpackov said:

> Hi James,
>
> <[hidden email]> writes:
>
>> I may just be showing my ignorance here, but how do people feel about
>> Xerces? Especially given that it's written in C++.
>
> Here is what I know about Xerces-C++ from experience:
>
>  - Out of all mentioned parsers (expat, libxml2, tinyxml) it is the only
>    validating parser that supports both DTD and XML Schema. I think libxml2
>    supports only DTD and the other two do not support any validation.
>
>  - Fairly complete support for advanced XML features, e.g., namespaces,
>    entity references, CDATA, etc.
>
>  - Extensive support for character encodings.
>
>  - Supports DOM and SAX in one package.
>
>  - C++ API. It is sometimes quite ugly, though.
>
>  - Fairly portable.
>
>
>> (Note: I'm trying to install Xerces now on Solaris, and it isn't easy.)
>
> I didn't find the installation any more difficult than say... boost ;-).
>
> hth,
> -boris
>
>
> --
> Boris Kolpackov
> Code Synthesis Tools CC
> http://www.codesynthesis.com
> Open Source Cross-Platform C++ XML Data Binding
>
>
>
>From my experience working with Xerces 2.6 and 2.7 I can complain about extremely bad
documentation. Sometimes I had to debug though xerces source code to understand how it works. In
some cases where documentation stated that the particular DOM Interface is implemented
NotImplementedException was thrown. The most disturbing thing is that you can not rely on
documentation and in most cases documentation even does not state if this particular interface
might throw an exception which can lead to unpleasent result at runtime...

You also need to write a wrapper class around Xerces XMLCh type and static XMLString member
functions, because these functions are not exception safe in terms of RAII, e.g.

//pre initialization here
XMLCh* xmlStr=XMLString::transcode("some string");

//some code
//some exception

XMLString::release(xmlStr); //never reached => memory leak

All document nodes were belonging to a document and you had to explicitly transform the ownership
or release them which is also more or less C style programming...

I always had a feeling to program C with C++ features... My suggestion would be if you can select
something else choose another library...



At some of the boost pages I found a reference to XiMoL project... This project seems to be a nice
alternative to Xerces C. I do not know which features do you need...



With Kind Regards,

Ovanes Markarian

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
12