コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the OpenXmlValidator.
        /// </summary>
        /// <param name="fileFormat">The target file format to be validated against.</param>
        /// <remarks>
        /// Default to FileFormat.Office2007.
        /// </remarks>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="fileFormat"/> parameter is not a known format.</exception>
        public OpenXmlValidator(FileFormatVersions fileFormat)
        {
            fileFormat.ThrowExceptionIfFileFormatNotSupported(nameof(fileFormat));

            _settings = new ValidationSettings(fileFormat);
            _cache    = new ValidationCache(fileFormat);
        }
コード例 #2
0
        public ValidationContext(ValidationSettings settings, ValidationCache cache)
        {
            Cache     = cache ?? throw new ArgumentNullException(nameof(cache));
            Settings  = settings ?? throw new ArgumentNullException(nameof(settings));
            Errors    = new List <ValidationErrorInfo>();
            McContext = new MCContext(false);

            // Start off with a depth of 5
            _elements = new Stack <CurrentElement>(5);
            _elements.Push(new CurrentElement(null, default, false, Errors.Add));
コード例 #3
0
        public ValidationContext(ValidationSettings settings, ValidationCache cache)
        {
            Cache     = cache ?? throw new ArgumentNullException(nameof(cache));
            Settings  = settings ?? throw new ArgumentNullException(nameof(settings));
            Errors    = new List <ValidationErrorInfo>();
            McContext = new MCContext(false);

            Stack = new ValidationStack();

            Stack.Push(Errors.Add);
        }
コード例 #4
0
        public ValidationContext(ValidationSettings settings, ValidationCache cache, CancellationToken token)
        {
            _token = token;

            Cache     = cache ?? throw new ArgumentNullException(nameof(cache));
            Settings  = settings ?? throw new ArgumentNullException(nameof(settings));
            Errors    = new List <ValidationErrorInfo>();
            McContext = new MCContext(false);

            Stack = new ValidationStack();
            State = new StateManager(this);

            Stack.Push(Errors.Add);
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the DocumentValidator.
 /// </summary>
 /// <param name="schemaValidator">The schema validator to be used for schema validation.</param>
 /// <param name="semanticValidator">The semantic validator to be used for semantic validation.</param>
 /// <param name="cache">The shared validation cache.</param>
 public DocumentValidator(SchemaValidator schemaValidator, SemanticValidator semanticValidator, ValidationCache cache)
 {
     _cache             = cache;
     _schemaValidator   = schemaValidator;
     _semanticValidator = semanticValidator;
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the DocumentValidator.
 /// </summary>
 /// <param name="cache">The shared validation cache.</param>
 public DocumentValidator(ValidationCache cache)
 {
     _cache = cache;
 }