if (size() == 0) {
return EmptyDocument.EMPTY_DOCUMENT;
}
DocOp domOp = serializeDom();
DocOp annotationsOp = serializeAnnotations();
try {
final DocOp bothOps;
if (performValidation) {
bothOps = Composer.compose(domOp, annotationsOp);
} else {
bothOps = Composer.composeUnchecked(domOp, annotationsOp);
}