[ create a new paste ] login | about

Link: http://codepad.org/g6MRCnYN    [ raw code | fork ]

C++, pasted on Nov 8:
#ifndef XMLNODE_H
#define XMLNODE_H

#include "stdafx.h"

#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMElement.hpp>

#include <string>
#include <vector>

XERCES_CPP_NAMESPACE_USE

namespace XML
{

struct Attribute
{
	std::string key;
	std::string value;
};


class XMLNode
{
public:
	XMLNode::XMLNode();
	XMLNode::XMLNode(const XMLNode & copy);
	XMLNode::~XMLNode();
	
	void AddNodeAttribute(const std::string& key, const std::string& value);
	void AddNodeAttribute(const std::string& key, int value);
	void AddNodeAttribute(const std::string& key, double value);
	void AddNodeAttribute(const std::string& key, float value);
	void AddNodeName(const std::string& name);
	void AddNodeValue(const std::string& value);
	void AddInternalElement(DOMNode* p_node);
	
	XMLNode & operator=(XMLNode const & node);

	friend bool operator==(const XMLNode & lhs, const XMLNode & rhs); 
	friend bool operator!=(const XMLNode & lhs, const XMLNode & rhs);

	DOMElement* GetInternalElement();
	std::string GetNodeName() const;
	std::string GetNodeValue() const;
	std::vector<Attribute>& GetAttributeVector();

private:
	void AddInternalAttribute(const Attribute& attrib);
	void SetInternalAttributeValues(const std::string& key, const std::string& value);
	void AddNodeInternalValue(const std::string& value);

	DOMElement* element;
	std::string nodename;
	std::string nodevalue;

	size_t numberofattributes;
	std::vector<Attribute> v_attributes;

};



}

#endif


Create a new paste based on this one


Comments: