// Parse the XSD, measuring the number of bytes as we read ...
Map<?, ?> options = new HashMap<Object, Object>();
XSDParser parser = new XSDParser(options);
AtomicLong contentSize = new AtomicLong();
if (source.getCharacterStream() != null) {
reader = new SizeMeasuringReader(source.getCharacterStream(), contentSize);
source = new InputSource(reader);
} else {
stream = new SizeMeasuringInputStream(source.getByteStream(), contentSize);
source = new InputSource(stream);
}