Пример #1
1
        public override void Validate(XmlWriter output, SchematronRuntimeOptions options)
        {
            if (output == null) throw new ArgumentNullException("output");
             if (options == null) throw new ArgumentNullException("options");

             this.executable.Run(output, GetXsltOptions(options));
        }
Пример #2
0
        public virtual void Validate(TextWriter output, SchematronRuntimeOptions options)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            XmlWriter writer;
            XPathSerializationOptions serialization = options.Serialization;

            if (serialization != null)
            {
                XmlWriterSettings settings = new XmlWriterSettings();
                serialization.CopyTo(settings);

                writer = XmlWriter.Create(output, settings);
            }
            else
            {
                writer = XmlWriter.Create(output);
            }

            Validate(writer, options);

            writer.Close();
        }
Пример #3
0
        public override IXPathNavigable Validate(SchematronRuntimeOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            return(this.executable.Run(GetXsltOptions(options)));
        }
Пример #4
0
        public override void Validate(XmlWriter output, SchematronRuntimeOptions options)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            this.executable.Run(output, GetXsltOptions(options));
        }
Пример #5
0
        static XsltRuntimeOptions GetXsltOptions(SchematronRuntimeOptions options)
        {
            var xsltOptions = new XsltRuntimeOptions {
            InitialContextNode = options.Instance
             };

             if (!String.IsNullOrEmpty(options.Phase)) {
            xsltOptions.Parameters.Add(new XmlQualifiedName("phase"), options.Phase);
             }

             if (options.Parameters != null) {
            foreach (var p in options.Parameters) {
               xsltOptions.Parameters.Add(p);
            }
             }

             return xsltOptions;
        }
Пример #6
0
        static XsltRuntimeOptions GetXsltOptions(SchematronRuntimeOptions options)
        {
            var xsltOptions = new XsltRuntimeOptions {
                InitialContextNode = options.Instance
            };

            if (!String.IsNullOrEmpty(options.Phase))
            {
                xsltOptions.Parameters.Add(new XmlQualifiedName("phase"), options.Phase);
            }

            if (options.Parameters != null)
            {
                foreach (var p in options.Parameters)
                {
                    xsltOptions.Parameters.Add(p);
                }
            }

            return(xsltOptions);
        }
Пример #7
0
        public virtual void Validate(TextWriter output, SchematronRuntimeOptions options)
        {
            if (output == null) throw new ArgumentNullException("output");
             if (options == null) throw new ArgumentNullException("options");

             XmlWriter writer;
             XPathSerializationOptions serialization = options.Serialization;

             if (serialization != null) {

            XmlWriterSettings settings = new XmlWriterSettings();
            serialization.CopyTo(settings);

            writer = XmlWriter.Create(output, settings);
             } else {
            writer = XmlWriter.Create(output);
             }

             Validate(writer, options);

             writer.Close();
        }
Пример #8
0
        public XPathNavigator Report(XPathItem schema, XPathNavigator source, string phase, IEnumerable <XPathNavigator> parameters)
        {
            var options = new SchematronRuntimeOptions {
                Instance = source,
                Phase    = phase
            };

            if (parameters != null)
            {
                foreach (XPathNavigator n in parameters)
                {
                    options.Parameters.Add(new XmlQualifiedName(n.Name, n.NamespaceURI), n.TypedValue);
                }
            }

            SchematronInvoker invoker;

            if (schema.IsNode)
            {
                if (this.Processor == null)
                {
                    throw new InvalidOperationException("Processor cannot be null");
                }

                invoker = SchematronInvoker.With((XPathNavigator)schema, this.Processor);
            }
            else
            {
                Uri schemaUri = SchemaAsUri(schema);

                invoker = SchematronInvoker.With(schemaUri: schema.Value);
            }

            return(invoker
                   .Validate(options)
                   .ToDocument()
                   .CreateNavigator());
        }
Пример #9
0
        public SchematronResultHandler Validate(IXPathNavigable input, string phase, object parameters)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            var options = new SchematronRuntimeOptions {
                Instance         = input,
                InputXmlResolver = this.resolver,
                Phase            = phase
            };

            if (parameters != null)
            {
                foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(parameters))
                {
                    options.Parameters.Add(new XmlQualifiedName(property.Name), property.GetValue(parameters));
                }
            }

            return(Validate(options));
        }
Пример #10
0
 public abstract void Validate(XmlWriter output, SchematronRuntimeOptions options);
Пример #11
0
        public SchematronResultHandler Validate(IXPathNavigable input, string phase, object parameters)
        {
            if (input == null) throw new ArgumentNullException("input");

             var options = new SchematronRuntimeOptions {
            Instance = input,
            InputXmlResolver = this.resolver,
            Phase = phase
             };

             if (parameters != null) {

            foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(parameters)) {
               options.Parameters.Add(new XmlQualifiedName(property.Name), property.GetValue(parameters));
            }
             }

             return Validate(options);
        }
Пример #12
0
 public abstract IXPathNavigable Validate(SchematronRuntimeOptions options);
Пример #13
0
        public override IXPathNavigable Validate(SchematronRuntimeOptions options)
        {
            if (options == null) throw new ArgumentNullException("options");

             return this.executable.Run(GetXsltOptions(options));
        }
Пример #14
0
 public SchematronResultHandler Validate(SchematronRuntimeOptions options)
 {
     return new SchematronResultHandler(this.validator, options);
 }
Пример #15
0
 internal SchematronResultHandler(SchematronValidator validator, SchematronRuntimeOptions options)
 {
     this.validator = validator;
      this.options = options;
      this.defaultSerialization = options.Serialization;
 }
Пример #16
0
 public abstract IXPathNavigable Validate(SchematronRuntimeOptions options);
Пример #17
0
 public abstract void Validate(XmlWriter output, SchematronRuntimeOptions options);
Пример #18
0
 internal SchematronResultHandler(SchematronValidator validator, SchematronRuntimeOptions options)
 {
     this.validator            = validator;
     this.options              = options;
     this.defaultSerialization = options.Serialization;
 }
Пример #19
0
 public SchematronResultHandler Validate(SchematronRuntimeOptions options)
 {
     return(new SchematronResultHandler(this.validator, options));
 }