Rapidxml is not compiling on Visual Studio 2010. What am I doing wrong?
I am working on switching XML parsers from TinyXml to RapidXml in our codebase.
However, RapidXml does not seem to compile with Visual Studio 2010.
Basically, in the header file I am doing
#define RAPIDXML_NO_EXCEPTIONS
#include "RapidXml/rapidxml.hpp"
using namespace rapidxml;
And in the implementation
xml_document<> xmlDoc;
xmlDoc.parse<0>(filestring);
And right there, on my second line of code, Visual Studio says
c:\users\name\development\rapidxml\rapidxml.hpp(420): error C2061: syntax erro开发者_开发问答r : identifier 'memory'
1> c:\users\name\development\rapidxml\rapidxml.hpp(418) : while compiling class template member function 'rapidxml::xml_node<> *rapidxml::memory_pool::allocate_node(rapidxml::node_type,const Ch *,const Ch *,size_t,size_t)' 1> with 1> [ 1> Ch=char 1> ] 1> c:\users\name\development\rapidxml\rapidxml.hpp(1359) : see reference to class template instantiation 'rapidxml::memory_pool' being compiled 1> with 1> [ 1> Ch=char 1> ] 1> c:\users\name\development\xmlresource.cpp(70) : see reference to class template instantiation 'rapidxml::xml_document<>' being compiled
It is the end of a long coding day and this is about it for today. Do you knowledgeable people out there have any idea what I am doing wrong here?
Here's some sample code I use, perhaps it will help?
#include <rapidxml.hpp>
rapidxml::xml_document<> doc;
doc.parse<rapidxml::parse_no_data_nodes | rapidxml::parse_trim_whitespace>( buffer );
rapidxml::xml_node<>* root;
root = doc.first_node();
if ( root )
{
rapidxml::xml_node<>* cur_node;
cur_node = root->first_node( "SessionLoginDeadline" );
if ( cur_node )
SessionLoginDeadline = cur_node->value();
cur_node = root->first_node( "Port" );
if ( cur_node )
Port = stringTo<unsigned short>( cur_node->value() );
cur_node = root->first_node( "MaximumAllowedClients" );
if ( cur_node )
MaximumAllowedClients = stringTo<unsigned short>( cur_node->value() );
}
Here is my actual problem:
As part of some memory debugging, I overloaded new with a version that does not support placement new. However, rapidxml does require placement new to work, so that is where those errors came from. Oh my.
精彩评论