18 XMLWriter::XMLWriter(ostream* out,
string indentString,
string aDefaultNameSpace)
41 *
writer <<
"<?xml version=\"" << version.c_str() <<
"\" ";
42 if (encoding.compare(
"") != 0) {
44 *
writer <<
"encoding=\"" << encoding.c_str() <<
"\" ";
47 *
writer <<
"standalone=\"yes\" ";
56 cerr <<
"XMLWriter::ReferToDTD cannot be called twice" << endl;
59 *
writer <<
"<!DOCTYPE " << name.c_str() <<
" PUBLIC \"" << pid.c_str() <<
"\" \"" << ref.c_str() <<
"\">" << endl;
64 cerr <<
"XMLWriter::ReferToDTD cannot be called twice";
67 *
writer <<
"<!DOCTYPE " << name.c_str() <<
" SYSTEM \"" << system.c_str() <<
"\">" << endl;
73 if (!force) cerr <<
"Not all tags were closed before closing XML document:" << endl;
78 cerr <<
" </" <<
openTags.top().c_str() <<
">" << endl;
88 if (comment.find(
"--") != string::npos) {
89 cerr <<
"XMLWriter::printComment '--' sequence not allowed in comment" << endl;
110 cerr <<
"XMLWriter::openTag(), First tag: '" << name <<
"' not equal to DTD id: '" <<
dtdName <<
"'" << endl;
112 *
writer <<
"<" << name.c_str();
122 cerr <<
"XMLWriter::closeTag(), No open tags" << endl;
127 *
writer <<
"</" << name.c_str() <<
">" << endl;
132 *
writer <<
"<" << name.c_str();
147 if (name ==
"value")
setAttribute(
"type", (std::string)
"Color");
152 if (name ==
"value")
setAttribute(
"type", (std::string)
"long");
157 if (name ==
"showlabel") {
161 if (name ==
"value")
setAttribute(
"type", (std::string)
"int");
167 if (name ==
"value")
setAttribute(
"type", (std::string)
"boolean");
172 if (name ==
"value")
setAttribute(
"type", (std::string)
"double");
177 int width = tagLength + 1;
178 bool extraIndent =
false;
180 string key = i->first;
183 int length = key.length() + value.length() + 3;
195 *
writer << key.c_str() <<
"=\"" << value.c_str() <<
"\"";
205 int len = s.length();
206 for (
int i = 0; i <
len; i++) {
222 str.append(
""");
227 sprintf(buffer,
"&#%ud", ch);
250 int len = s.length();
251 for (
int i = 0; i <
len; i++) {
std::stack< std::string > openTags
system("rm -rf microbeam.root")
void openTag(std::string name)
std::string getAsString()
std::string toShowLabel()
void print(std::string text)
void printComment(std::string comment)
std::string normalize(std::string s)
const XML_Char const XML_Char int standalone
std::string normalizeText(std::string s)
void println(std::string text)
void referToDTD(std::string name, std::string pid, std::string ref)
std::map< std::string, std::string > attributes
const XML_Char int const XML_Char * value
void setAttribute(std::string name, char *value)
void printPlain(std::string text)
void setIndentString(const std::string &indentString)
void printAttributes(int tagLength)
void checkNameValid(std::string s)
IndentPrintWriter * writer
void closeDoc(bool force=false)
void openDoc(std::string version="1.0", std::string encoding="", bool standalone=false)
void printTag(std::string name)
std::string getIndentString() const