Click here to Skip to main content
15,881,657 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.5K   2.6K   43  
An example for reusable code - an XML writer class



#include "xmlwriter.h"


int main(int argc, char* argv[])
{
	xmlwriter MyXml("boby.xml");
	MyXml.AddAtributes("age","25");	
	MyXml.AddAtributes("Profession","Software");	
	MyXml.Createtag("Boby");
	
	MyXml.AddComment("Personal information");
	MyXml.Createtag("Home"); // create node boby
	MyXml.CreateChild("Address","Pazheparampil"); // add element
	MyXml.CreateChild("Mobile","09844400873");
	MyXml.CloseLasttag(); // close boby


	MyXml.AddComment("Office information");
	MyXml.Createtag("Office"); // create node boby
	MyXml.CreateChild("Address","Bangalore"); // add element
	MyXml.CreateChild("Ph","0091234567");
	MyXml.CloseLasttag(); // close Office
	
	
	MyXml.CloseAlltags();

	cout<<"See boby.xml for output";

	return 0;
}

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