Click here to Skip to main content
15,892,674 members
Articles / Programming Languages / Objective C

XMLWriter - A Simple Reusable Class

Rate me:
Please Sign up or sign in to vote.
4.86/5 (41 votes)
20 Mar 2006CPOL2 min read 95.8K   2.6K   43  
An example for reusable code - an XML writer class
#ifndef xmlwriter_h
#define xmlwriter_h

#include<iostream>
#include<string>
#include<vector>
#include <stack>
using namespace std;
typedef stack<string> StackStrings;


class xmlwriter{
public:
	xmlwriter(string sTmp);
	~xmlwriter();
	void CreateChild(string sTag,string sValue);
	void Createtag(string sTag);
	void CloseLasttag();
	void CloseAlltags();
	void AddAtributes(string sAttrName, string sAttrvalue);
	void AddComment(string sComment);
private:
	string sXmlFile;
	vector<string> vectAttrData;
	FILE *fp;
	int iLevel;
	StackStrings sTagStack;
};

#endif // xmlwriter_h


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
Software Developer (Senior) DWS
Australia Australia

Comments and Discussions