Click here to Skip to main content
15,897,273 members
Articles / Desktop Programming / MFC

Simple C++ XML Parser

Rate me:
Please Sign up or sign in to vote.
3.56/5 (17 votes)
1 Oct 2010CPOL5 min read 183.5K   6.6K   30  
A Simple C++ XML parser with only the basic functionality
#pragma once
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include <tchar.h>
#include "windows.h"
//#include "mem.h"
class CAttribute
{
public:
	CAttribute(void);
	CAttribute(CAttribute* a);
	~CAttribute(void);
private:
	// The string value of the attribute
	_TCHAR* m_szValue;
	// The name of the attribute
	_TCHAR* m_szName;
public:
	// Gets The name of the attribute
	_TCHAR* GetName(void);
	// gets the value of the attribute
	_TCHAR* GetValue(void);
	// Setter for the value of the attribute
	bool SetValue(_TCHAR* szValue);
	// Setter for the name of the attribute
	bool SetName(_TCHAR* szName);
	// Operator for sorting
	bool operator < (CAttribute& a);
	bool operator == (CAttribute& a);
	bool operator == (_TCHAR* a);
	bool operator > (CAttribute& a);
	CAttribute &operator = ( CAttribute& a);
	CAttribute *operator = ( CAttribute* a);

private:
	// falg var for knowing if the value has been previously allocated
	bool m_bValAlloc;
	// falg var for knowing if the name has been previously allocated
	bool m_bNameAlloc;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Romania Romania
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions