Example #1
0
        private static ValidationResult Validate(ViolationCollector collector, IDocumentSchema schema, IAutomatonDocument document, IDocOp docOp)
        {
            if (schema == null)
            {
                schema = DocumentSchema.NoSchemaConstraints;
            }

            var automation = new DocOpAutomaton(document, schema);
            var accu = new ValidationResult[] { ValidationResult.Valid };
            try
            {
                docOp.Apply(new ValidationDocOpCursor(collector, automation, accu));
            }
            catch (IllFormedException illFormed)
            {
                return ValidationResult.IllFormed;
            }

            accu[0] = accu[0].MergeWith(automation.CheckFinish(collector));
            return accu[0];
        }
Example #2
0
 internal ValidationResult NotClosed(DocOpAutomaton automaton, ViolationCollector collector)
 {
     return automaton.MismatchedInsertStart(collector);
 }