xmlwriter Class Reference
#include <xmlwriter.h>
List of all members.
Detailed Description
Definition at line 13 of file xmlwriter.h.
Constructor & Destructor Documentation
xmlwriter::xmlwriter |
( |
string |
sTmp |
) |
|
Definition at line 5 of file xmlwriter.cpp.
00006 {
00007 sXmlFile = sTmp;
00008 fp = NULL;
00009 iLevel = 0;
00010 fp = fopen(sXmlFile.c_str(),"w");
00011 if(fp == NULL)
00012 {
00013 std::cout<<"Unable to open output file";
00014 return;
00015 }
00016 else
00017 {
00018 fprintf(fp,"<?xml version=\"1.0\" encoding=\"UTF-8\" \?>");
00019 }
00020 }
xmlwriter::~xmlwriter |
( |
|
) |
|
Definition at line 22 of file xmlwriter.cpp.
00023 {
00024 if(fp != NULL)
00025 fclose(fp);
00026 if (vectAttrData.size() != 0)
00027 throw new Exception("Not all xml tags were closed");
00028
00029 }
Member Function Documentation
void xmlwriter::AddAttributes |
( |
string |
sAttrName, |
|
|
string |
sAttrvalue | |
|
) |
| | |
void xmlwriter::AddComment |
( |
string |
sComment |
) |
|
Definition at line 133 of file xmlwriter.cpp.
00134 {
00135 NewLine();
00136 fprintf(fp,"<!--%s-->",sComment.c_str());
00137 }
void xmlwriter::AddString |
( |
string |
str |
) |
|
void xmlwriter::CloseAlltags |
( |
|
) |
|
void xmlwriter::CloseTag |
( |
std::string |
sTag |
) |
|
void xmlwriter::CloseTag |
( |
|
) |
|
void xmlwriter::CreateChild |
( |
string |
sTag, |
|
|
string |
sValue | |
|
) |
| | |
Definition at line 105 of file xmlwriter.cpp.
00106 {
00107 NewLine();
00108
00109
00110 fprintf(fp,"<%s",sTag.c_str());
00111
00112 unsigned i=0;
00113 while(i<vectAttrData.size())
00114 {
00115 string sTmp = vectAttrData[i];
00116 fprintf(fp," %s=", sTmp.c_str());
00117 sTmp = vectAttrData[i+1];
00118 fprintf(fp,"\"%s\"", sTmp.c_str());
00119 i+=2;
00120 }
00121 vectAttrData.clear();
00122
00123 fprintf(fp,">%s</%s>",sValue.c_str(),sTag.c_str());
00124 }
void xmlwriter::CreateEmptyElement |
( |
string |
sTag |
) |
|
Definition at line 54 of file xmlwriter.cpp.
00055 {
00056 NewLine();
00057 fprintf(fp,"<%s",sTag.c_str());
00058
00059 unsigned i=0;
00060 while(i<vectAttrData.size())
00061 {
00062 string sTmp = vectAttrData[i];
00063 fprintf(fp," %s=", sTmp.c_str());
00064 sTmp = vectAttrData[i+1];
00065 fprintf(fp,"\"%s\"", sTmp.c_str());
00066 i+=2;
00067 }
00068 vectAttrData.clear();
00069 fprintf(fp,"/>");
00070
00071 }
void xmlwriter::CreateTag |
( |
string |
sTag |
) |
|
void xmlwriter::NewLine |
( |
|
) |
[private] |
Definition at line 146 of file xmlwriter.cpp.
00147 {
00148
00149 fprintf(fp,"\n");
00150 for(int iTmp =0;iTmp<iLevel;iTmp++)
00151 fprintf(fp," ");
00152
00153 }
Member Data Documentation
The documentation for this class was generated from the following files: