Exemplo n.º 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));
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
        public override IXPathNavigable Validate(SchematronRuntimeOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            return(this.executable.Run(GetXsltOptions(options)));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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());
        }
Exemplo n.º 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));
        }
Exemplo n.º 10
0
 public abstract void Validate(XmlWriter output, SchematronRuntimeOptions options);
Exemplo n.º 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);
        }
Exemplo n.º 12
0
 public abstract IXPathNavigable Validate(SchematronRuntimeOptions options);
Exemplo n.º 13
0
        public override IXPathNavigable Validate(SchematronRuntimeOptions options)
        {
            if (options == null) throw new ArgumentNullException("options");

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