What is the best open XML parser for C++? [duplicate]

How about RapidXML? RapidXML is a very fast and small XML DOM parser written in C++. It is aimed primarily at embedded environments, computer games, or any other applications where available memory or CPU processing power comes at a premium. RapidXML is licensed under Boost Software License and its source code is freely available.

Features

  • Parsing speed (including DOM tree
    building) approaching speed of
    strlen function executed on the
    same data.
  • On a modern CPU (as of 2008) the
    parser throughput is about 1 billion
    characters per second. See
    Performance section in the Online
    Manual.
  • Small memory footprint of the code
    and created DOM trees.
  • A headers-only implementation,
    simplifying the integration process.
  • Simple license that allows use for
    almost any purpose, both commercial
    and non-commercial, without any
    obligations.
  • Supports UTF-8 and partially UTF-16,
    UTF-32 encodings.
  • Portable source code with no
    dependencies other than a very small
    subset of C++ Standard Library.
  • This subset is so small that it can
    be easily emulated manually if use
    of standard library is undesired.

Limitations

  • The parser ignores DOCTYPE
    declarations.
  • There is no support for XML namespaces.
  • The parser does not check for
    character validity.
  • The interface of the parser does not
    conform to DOM specification.
  • The parser does not check for
    attribute uniqueness.

Source: wikipedia.org://Rapidxml


Depending on you use, you may use an XML Data Binding? CodeSynthesis XSD is an XML Data Binding compiler for C++ developed by Code Synthesis and dual-licensed under the GNU GPL and a proprietary license. Given an XML instance specification (XML Schema), it generates C++ classes that represent the given vocabulary as well as parsing and serialization code.

One of the unique features of CodeSynthesis XSD is its support for two different XML Schema to C++ mappings: in-memory C++/Tree and stream-oriented C++/Parser. The C++/Tree mapping is a traditional mapping with a tree-like, in-memory data structure. C++/Parser is a new, SAX-like mapping which represents the information stored in XML instance documents as a hierarchy of vocabulary-specific parsing events. In comparison to C++/Tree, the C++/Parser mapping allows one to handle large XML documents that would not fit in memory, perform stream-oriented processing, or use an existing in-memory representation.

Source: wikipedia.org://CodeSynthesis XSD

Leave a Comment