ChaseRLewis -3 Junior Poster in Training

Well I've been following the rapidxml sparse documentation but I'm getting confused because I'm getting an error saying "expected =" when I call parse<0>(char* c). Messy code I know, but trying to figure out how to use this api I'm new with.

Loading Code

bool Shader::Load(const char* path)
{
	std::ifstream file;

	std::string xml_as_string;
	file.open(path);
	if(!file.is_open())
	{
		//TODO:: BETTER ERROR HANDLING
		return false;
	}
	char c;
	while(file.get(c))
	{
		xml_as_string.push_back(c);
	}
	file.close();
	xml_as_string.push_back('\0');
	xml_as_string.shrink_to_fit();
	xml_document<> doc;
	printf("\n\n%s\n\n",xml_as_string.c_str());
	try
	{
        //WHERE ERROR OCCURS
	doc.parse<0>((char*)(xml_as_string.c_str()));
	}
	catch(std::exception& e)
	{
		printf("exception caught: %s\n",e.what()); 
	}
	printf("Name of first node: %s",doc.first_node()->name());
	return true;
}

Saving Code

void Shader::Save(const char* path)
{

	//****************************************************
	//Check To See If Saving Is Possible TODO::Add Error Code
	//****************************************************
	if(m_ShaderName.empty())
	{
		return;
	}
	else if(m_VertexShader.empty())
	{
		return;
	}
	else if(m_FragmentShader.empty())
	{
		return;
	}
	//****************************************************
	xml_document<> doc;
	//****************************************************
	//Declaration
	//****************************************************
	xml_node<> *decl = doc.allocate_node(node_declaration);
	decl->append_attribute(doc.allocate_attribute("encoding","utf-8"));
	decl->append_attribute(doc.allocate_attribute("type","shader"));
	doc.append_node(decl);
	//****************************************************
	//Shader Information
	//****************************************************
	xml_node<>* root = doc.allocate_node(node_element,"Shader");
	root->append_attribute(doc.allocate_attribute("version","1.0"));
	root->append_attribute(doc.allocate_attribute("shader version","130"));
	
	if(!m_ShaderName.empty())
	root->append_attribute(doc.allocate_attribute("name",m_ShaderName.c_str()));

	doc.append_node(root);
	//****************************************************
	//Vertex Shader Information
	//****************************************************
	xml_node<>* vertexshader = doc.allocate_node(node_element,"vertex shader");
	vertexshader->append_attribute(doc.allocate_attribute("body",m_VertexShader.c_str()));
	root->append_node(vertexshader);
	//****************************************************
	//Per Input Vertex Information
	//****************************************************
	xml_node<>* input_per_vertex_vs = doc.allocate_node(node_element,"input per vertex");
	xml_node<>**  vertex_attributes = new xml_node<>*[m_VertexAttributes.size()];
	const char variable_type[] = "variable_type";
	for(unsigned int i = 0; i < m_VertexAttributes.size();++i)
	{
		vertex_attributes[i] = doc.allocate_node(node_element,"per vertex");
		vertex_attributes[i]->append_attribute(doc.allocate_attribute("variable_name",m_VertexAttributes[i].c_str()));
		
		switch(m_VertexIdentifiers[i])
		{
		case VEC4:
		vertex_attributes[i]->append_attribute(doc.allocate_attribute(variable_type,"vec4"));
		break;
		case VEC3:
		vertex_attributes[i]->append_attribute(doc.allocate_attribute(variable_type,"vec3"));
		break;
		case VEC2:
		vertex_attributes[i]->append_attribute(doc.allocate_attribute(variable_type,"vec2"));
		break;
		case VEC:
		vertex_attributes[i]->append_attribute(doc.allocate_attribute(variable_type,"float"));
		break;
		default:
		break;
		}
		
		input_per_vertex_vs->append_node(vertex_attributes[i]);
	}

	root->append_node(input_per_vertex_vs);
	//***********************************************************
	//Fragment Shader Information
	//***********************************************************
	xml_node<>* fragmentshader = doc.allocate_node(node_element,"fragmentshader");
	fragmentshader->append_attribute(doc.allocate_attribute("body",m_FragmentShader.c_str()));
	root->append_node(fragmentshader);
	//************************************************************
	//Geometry Shader Information
	//************************************************************
	xml_node<>* geometryshader = doc.allocate_node(node_element,"geometryshader");
	if(m_GeometryShader.empty())
	{
		geometryshader->append_attribute(doc.allocate_attribute("body",""));
	}
	else
	geometryshader->append_attribute(doc.allocate_attribute("body",m_GeometryShader.c_str()));
		
	root->append_node(geometryshader);
	//*********************************
	//Print File To String
	//*********************************
	std::string xml_as_string;
	rapidxml::print(std::back_inserter(xml_as_string),doc);
	printf("\n*******\n%s\n*******\n",xml_as_string.c_str());
	std::ofstream file;

	//TODO::Check for xml ender.

	file.open(path);
	if(file.is_open())
	{
	file << xml_as_string;
	}
	file.close();
	//**********************************
	//Clean Up
	//**********************************
	delete[] vertex_attributes;
}

Output of input and output (they are 100% identical when I put them both into strings the computer even evaluates them as identical).

<?xml encoding="utf-8" type="shader"?>
<Shader version="1.0" shader version="130" name="BasicTexture_v4v2">
	<vertex shader body="#version 130

in vec4 v_Vertex;
in vec2 v_TexCoord;

out vec4 f_Color;
out vec2 f_TexCoord;

uniform mat4x4 WorldViewProjection;


void main(void)
{
	gl_Position = WorldViewProjection*v_Vertex;
	f_TexCoord = v_TexCoord;
}
"/>
	<input per vertex>
		<per vertex variable_name="v_Vertex" variable_type="vec4"/>
		<per vertex variable_name="v_TexCoord" variable_type="vec2"/>
	</input per vertex>
	<fragmentshader body="#version 130

in vec2 f_TexCoord;

out vec4 FragmentColor;

uniform sampler2D f_texture;

void main(void)
{
	FragmentColor = texture(f_texture,f_TexCoord);
}
"/>
	<geometryshader body=""/>
</Shader>