@Override
public void saxSource(XMLReader reader, InputSource inputSource) throws IOException, SAXException {
try {
Builder builder = new Builder(reader);
Document document;
if (inputSource.getByteStream() != null) {
document = builder.build(inputSource.getByteStream());
}
else if (inputSource.getCharacterStream() != null) {
document = builder.build(inputSource.getCharacterStream());
}
else {
throw new IllegalArgumentException(
"InputSource in SAXSource contains neither byte stream nor character stream");
}
element = document.getRootElement();
}
catch (ValidityException ex) {
throw new XomParsingException(ex);
}
catch (ParsingException ex) {