ErrorHandler erh=null;
if(ch instanceof ErrorHandler) {
erh=(ErrorHandler)ch;
}
LexicalHandler lh=null;
if(ch instanceof LexicalHandler) {
lh=(LexicalHandler)ch;
}
Enumeration args = eventArguments.elements ();
ThreeString ths;
CharBlock cd;
TwoString ts;
FourString fs;
SAXParseException e;
for (Enumeration types = eventTypes.elements (); types.hasMoreElements ();) {
Integer type = (Integer)types.nextElement();
// ContentHandler events
if (STARTDOCUMENT.equals(type)) {
ch.startDocument ();
} else if (ENDDOCUMENT.equals(type)) {
ch.endDocument ();
} else if (STARTPREFIXMAPPING.equals(type)) {
ts=(TwoString) args.nextElement();
ch.startPrefixMapping(ts.first,ts.second);
} else if (ENDPREFIXMAPPING.equals(type)) {
ch.endPrefixMapping((String)args.nextElement());
} else if (STARTELEMENT.equals(type)) {
StartElementData sed = (StartElementData) args.nextElement ();
ch.startElement (sed.getURI(), sed.getLocalName(), sed.getQName(),sed.getAtts());
} else if (ENDELEMENT.equals(type)) {
ths = (ThreeString) args.nextElement ();
ch.endElement (ths.first,ths.second,ths.third);
} else if (CHARACTERS.equals(type)) {
cd = (CharBlock) args.nextElement ();
ch.characters (cd.getCh(), cd.getStart(), cd.getLength());
} else if (IGNORABLEWHITESPACE.equals(type)) {
cd = (CharBlock) args.nextElement ();
ch.ignorableWhitespace (cd.getCh(), cd.getStart(), cd.getLength());
} else if (PROCESSINGINSTRUCTION.equals(type)) {
ts=(TwoString) args.nextElement();
ch.processingInstruction (ts.first,ts.second);
// DTDHandler events
} else if (NOTATIONDECL.equals(type)) {
if(dtdh!=null) {
ths=(ThreeString) args.nextElement();
dtdh.notationDecl(ths.first,ths.second,ths.third);
}
} else if (UNPARSEDENTITYDECL.equals(type)) {
if(dtdh!=null) {
fs=(FourString) args.nextElement();
dtdh.unparsedEntityDecl(fs.first,fs.second,fs.third,fs.fourth);
}
// ErrorHandler events
} else if (WARNING.equals(type)) {
if(erh!=null) {
e=(SAXParseException) args.nextElement();
erh.warning(e);
}
} else if (ERROR.equals(type)) {
if(erh!=null) {
e=(SAXParseException) args.nextElement();
erh.error(e);
}
} else if (FATALERROR.equals(type)) {
if(erh!=null) {
e=(SAXParseException) args.nextElement();
erh.fatalError(e);
}
// LexicalHandler events
} else if (STARTDTD.equals(type)) {
if(lh!=null) {
ths=(ThreeString) args.nextElement();
lh.startDTD(ths.first,ths.second,ths.third);
}
} else if (ENDDTD.equals(type)) {
if(lh!=null) {
lh.endDTD();
}
} else if (STARTENTITY.equals(type)) {
if(lh!=null) {
String n=(String) args.nextElement();
lh.startEntity(n);
}
} else if (ENDENTITY.equals(type)) {
if(lh!=null) {
String n=(String) args.nextElement();
lh.endEntity(n);
}
} else if (STARTCDATA.equals(type)) {
if(lh!=null) {
lh.startCDATA();
}
} else if (ENDCDATA.equals(type)) {
if(lh!=null) {
lh.endCDATA();
}
} else if (COMMENT.equals(type)) {
if(lh!=null) {
CharBlock ccd = (CharBlock) args.nextElement ();
lh.comment (ccd.getCh(), ccd.getStart(), ccd.getLength());
}
}
}
} else {
// Logger.log (Logger.ERROR, "SAX2BufferImpl:stopBuffering() : trying to ouput buffer to a null ContentHandler.");