Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   Building a simple XML Parser (http://www.programmingforums.org/showthread.php?t=15159)

Soulstorm Feb 11th, 2008 11:52 AM

Building a simple XML Parser
 
I want to build a simple XML parser using C++. At first, I don't mind about DTD declarations or special features. I want to be able to load an XML string and then output the code in a simple tree holding strings (the values of the XML document)

But the problem is that although I know all about XML, I haven't got the slightest idea about how to make an XML parser (or any other parser of the same logic). I believe a recursive descent parser is sufficient.

Can anyone point me into the right direction? All I want is a general idea, like the way I will organize my classes, what STL classes would prove useful... A general documentation upon parsers would also be helpful (google should work, but I always find better answers in forums).

Game_Ender Feb 11th, 2008 4:59 PM

Re: Building a simple XML Parser
 
I would be a good book on parsing. One way to do that is to check out some good universities and see which book they use for their classes which cover the subject. (Sorry I don't know one of the top of my head)

Soulstorm Feb 12th, 2008 3:45 AM

Re: Building a simple XML Parser
 
I tried Xerces xml parser, but it has faults all over it. Namely, it includes files of the project using <this.h> and not "that.h". That was enough to give me hundreds of errors in XCode. And building it is next to impossible. Even the sample XCode project produces a framework which doesn't work, for this reason!

Maybe you know any ready cross-platform XML parser?

Game_Ender Feb 15th, 2008 9:41 AM

Re: Building a simple XML Parser
 
If that's all you wanted: TinyXML is your best bet for a quick solution. It is a DOM based parser, so it loads the entire file into memory upon parsing. The XML is basically turned into a tree which you can navigate. This means you really don't want to use if you have to process hundreds of megs of XML, but for many uses TinyXML is prefect.

EDIT: I am just a little floored, TinyXML is written by Lee Thomason, the "Programmer and technical lead for the Flash Player".


All times are GMT -5. The time now is 3:55 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC