*/
public void parse(InputSource source)
throws SAXException,
IOException
{
IXMLParser parser = this.createParser();
parser.setBuilder(this.adapter);
parser.setResolver(this.entityResolver);
Reader reader = source.getCharacterStream();
if (reader != null) {
parser.setReader(new StdXMLReader(reader));
} else {
InputStream stream = source.getByteStream();
if (stream != null) {
String encoding = source.getEncoding();
if (encoding != null) {
try {
reader = new InputStreamReader(stream, encoding);
parser.setReader(new StdXMLReader(reader));
} catch (UnsupportedEncodingException exception) {
throw new SAXException(exception);
}
} else { // if encoding == null
parser.setReader(new StdXMLReader(stream));
}
} else { // if stream == null
parser.setReader(new StdXMLReader(source.getPublicId(),
source.getSystemId()));
}
}
try {
parser.parse();
this.adapter.endDocument();
} catch (IOException exception) {
throw exception;
} catch (Exception exception) {
throw new SAXException(exception);