7 #include <xercesc/util/XMLUniDefs.hpp>
8 #include <xercesc/sax2/Attributes.hpp>
9 #include <xercesc/sax/SAXParseException.hpp>
10 #include <xercesc/sax/SAXException.hpp>
29 fFormatter(encodingName, this, XMLFormatter::NoEscapes, unRepFlags),
41 out.write ((
char *) toWrite, (
int) count) ;
50 fFormatter << chCloseParen << chSemiColon;
55 const XMLCh*
const qName,
const Attributes& attributes)
57 XMLCh attrLength[25]; XMLString::transcode(
"length",attrLength,24);
58 XMLCh attrGroupName[25]; XMLString::transcode(
"groupname",attrGroupName,24);
60 const char *temp = XMLString::transcode(localname);
61 fFormatter << XMLFormatter::NoEscapes ;
63 if (strcmp(temp,
"COMMENT")==0) {
64 fFormatter << chOpenSquare ;
67 if (strcmp(temp,
"BRANCH")==0) {
69 fFormatter << chComma ;
72 fFormatter << chOpenParen ;
73 gcBranchLengthArray[giBrLnCtr++] = XMLString::transcode(attributes.getValue(attrLength));
74 gcGroupNameArray[giGrNameCtr++] = XMLString::transcode(attributes.getValue(attrGroupName));
79 if (strcmp(temp,
"ITEM")==0) {
80 if ((gcLastItem && strcmp(gcLastItem,temp)==0) ||
gbLastBranch)
81 fFormatter << chComma ;
84 XMLCh attrItem[25]; XMLString::transcode(
"itemname",attrItem,24);
85 fFormatter << XMLFormatter::AttrEscapes
86 << attributes.getValue(attrItem)
87 << XMLFormatter::NoEscapes ;
91 const char *temp = XMLString::transcode(localname);
92 if (strcmp(temp,
"BRANCH")==0) {
95 fFormatter << chCloseParen ;
97 XMLString::transcode(gcGroupNameArray[--giGrNameCtr],
gxAttrGroupName,99);
103 else if (strcmp(temp,
"ITEM")==0) {
106 else if (strcmp(temp,
"COMMENT")==0) {
107 fFormatter << chCloseSquare << chOpenParen ;
114 fFormatter.formatBuf(chars, length, XMLFormatter::CharEscapes);
118 fFormatter.formatBuf(chars, length, XMLFormatter::NoEscapes);
127 cerr <<
"\nError at file " <<
StrX(e.getSystemId())
128 <<
", line " << e.getLineNumber()
129 <<
", char " << e.getColumnNumber()
130 <<
"\n Message: " <<
StrX(e.getMessage()) << endl;
134 cerr <<
"\nFatal Error at file " <<
StrX(e.getSystemId())
135 <<
", line " << e.getLineNumber()
136 <<
", char " << e.getColumnNumber()
137 <<
"\n Message: " <<
StrX(e.getMessage()) << endl;
141 cerr <<
"\nWarning at file " <<
StrX(e.getSystemId())
142 <<
", line " << e.getLineNumber()
143 <<
", char " << e.getColumnNumber()
144 <<
"\n Message: " <<
StrX(e.getMessage()) << endl;
void characters(const XMLCh *const chars, const unsigned int length)
XMLCh gxAttrBranchLength[10]
char * gcBranchLengthArray[100]
void ignorableWhitespace(const XMLCh *const chars, const unsigned int length)
void writeChars(const XMLByte *const toWrite)
XMLCh gxAttrGroupName[100]
void processingInstruction(const XMLCh *const target, const XMLCh *const data)
void endElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
char * gcGroupNameArray[100]
Sax2Handler(const char *const encodingName, const XMLFormatter::UnRepFlags unRepFlags, ofstream &outFile)
void error(const SAXParseException &exception)
void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attributes)
const XMLCh * gxAttrItemLength
void fatalError(const SAXParseException &exception)
void warning(const SAXParseException &exception)