Click here to Skip to main content
12,078,489 members (45,372 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ XML
i am using simple C++ in Visual Studio Express. I dont know how to parse XML in C++. What to do??

I was thinking of exporting XML classes from .NET as COM, and use it in C++..
How to do that if possible. plz guide me..
Posted 20-Jun-12 7:14am
Comments
Sergey Alexandrovich Kryukov 20-Jun-12 12:53pm
   
What to do? To use "Improve question" and provide a bit more information, primarily in tags.

It depends on the type of the project. Is this C++/CLI (for .NET, SLR platform), a native code, mixed-mode code, what. In other words, to know what libraries you can use, one needs to know what's the platform (don't tell us "Windows", this is not a complete characteristic of a platform), or application type.
--SA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

First of all, is your XML file a simple/small DOM file or a large XML, like a database?

If it is the first one, then use MSXML parser:
Parsing an XML file in a C/C++ program[^]
How to create a simple XML file using MSXML in C++[^]

If it is a large XML file - use one of so many-many implementations of C++ parsers like ones published on this forum or elsewhere, as was already suggested.
  Permalink  
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

There are so many possible solutions that the answer would deserve an article. And searching on Codeproject.com would bring lots of acceptable results. But if you need a relatively simple parser from native C++ code on Windows then XmlLite[^] from Microsoft can be recommended first.
Quote from MSDN article A Small And Fast XML Parser For Native C++[^]:
"Due to the simplicity of its design, XmlLite manages to provide considerably better performance, even when compared to the MSXML SAX2 implementation. Although the SAX2 parser is better at handling large documents than the DOM implementation, it pales in comparison to XmlLite.
Simply put, XmlLite outperforms MSXML and it is much easier to use from native C++. MSXML will remain the most viable solution for Visual Basic and COM-based scripting languages, but now native Visual C++® finally has an XML parser designed specifically for it."
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Use one of the many c++ XML classes that you can find here on code project.

We use our own class as a wrapper around MSXML.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160212.1 | Last Updated 20 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100