![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 243
Rep Power: 3
![]() |
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).
__________________
Project::Soulstorm (personal homepage) |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
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)
__________________
Robotics @ Maryland AUV Team - Software Lead |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 243
Rep Power: 3
![]() |
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?
__________________
Project::Soulstorm (personal homepage) |
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
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".
__________________
Robotics @ Maryland AUV Team - Software Lead |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pyparsing - Python parser library | ptmcg | Show Off Your Open Source Projects | 0 | Feb 11th, 2008 9:50 AM |
| Help Parsing 1.2 Gig XML File | fahlyn | Java | 9 | Jan 17th, 2008 7:09 PM |
| writing a parser in c++ | programmingnoob | C++ | 47 | Jul 24th, 2006 4:28 AM |
| SGML parser | printf | PHP | 1 | Oct 17th, 2005 5:52 PM |
| Simple Function Questions | meverha1 | C++ | 16 | Sep 12th, 2005 2:25 AM |