public final void endDocument() throws SAXException {
        try {
            os.write(toByteArray());
        } catch (IOException ex) {
            throw new SAXException(ex.toString(), ex);
        }
    }