* the document node at the root of the tree of the resulting in-memory document.
*/
public XdmNode build(Source source) throws SaxonApiException {
AugmentedSource as = AugmentedSource.makeAugmentedSource(source);
as.setDTDValidationMode(dtdValidation ? Validation.STRICT : Validation.STRIP);
if (schemaValidator != null) {
as.setSchemaValidationMode(schemaValidator.isLax() ? Validation.LAX : Validation.STRICT);
if (schemaValidator.getDocumentElementName() != null) {
as.setTopLevelElement(schemaValidator.getDocumentElementName().getStructuredQName());
}
if (schemaValidator.getDocumentElementType() != null) {
as.setTopLevelType(schemaValidator.getDocumentElementType());
}
}
if (whitespacePolicy != null) {
as.setStripSpace(whitespacePolicy.ordinal());
}
as.setLineNumbering(lineNumbering);
if (source.getSystemId() == null && baseURI != null) {
source.setSystemId(baseURI.toString());
}
try {
NodeInfo doc = config.buildDocument(as);