Пример #1
0
        internal void Load(Stream s, bool doSchematronValidation)
        {
            Reset();

            if (s == null)
            throw new ArgumentNullException("s");

            SchematronReader reader = new SchematronReader();
            using (XmlReader xmlReader = XmlReader.Create(s, reader.CreateXmlReaderSettings()))
            {
            reader.ReadSchema(this, xmlReader, doSchematronValidation);
            }
        }
Пример #2
0
        /// <summary>
        ///   Loads the <see cref="SchematronDocument"/> from the specified <see cref="TextReader"/>.
        /// </summary>
        /// <param name="textReader">The <see cref="TextReader"/> containing the document to load.</param>
        /// <remarks>
        ///   The following checks are performed on the document:
        ///   <list type="bullet">
        ///   <item>It is a well-formed XML document.</item>
        ///   <item>The <see cref="XmlDocument.DocumentElement"/> namespace is a <see cref="Schematron"/> namespace.</item>
        ///   <item>The document validates against the W3C XSD schema for a <see cref="SchematronDocument"/>.</item>
        ///   <item>The document validates against the Schematron schema for a <see cref="SchematronDocument"/>.</item>
        ///   </list>
        ///  <para>
        ///   <b>Load</b> accepts both "http://purl.oclc.org/dsdl/schematron" and "http://www.ascc.net/xml/schematron"
        ///   as valid namespaces.
        /// </para>
        /// </remarks>
        public void Load(TextReader textReader)
        {
            Reset();

             if (textReader == null)
             throw new ArgumentNullException("textReader");

            SchematronReader reader = new SchematronReader();
            using (XmlReader xmlReader = XmlReader.Create(textReader, reader.CreateXmlReaderSettings()))
            {
            reader.ReadSchema(this, xmlReader, true);
            }
        }
Пример #3
0
        /// <summary>
        ///   Loads the <see cref="SchematronDocument"/> from the specified URI.
        /// </summary>
        /// <param name="uri">The URI containing the document to load.</param>
        /// <remarks>
        ///   The following checks are performed on the document:
        ///   <list type="bullet">
        ///   <item>It is a well-formed XML document.</item>
        ///   <item>The <see cref="XmlDocument.DocumentElement"/> namespace is a <see cref="Schematron"/> namespace.</item>
        ///   <item>The document validates against the W3C XSD schema for a <see cref="SchematronDocument"/>.</item>
        ///   <item>The document validates against the Schematron schema for a <see cref="SchematronDocument"/>.</item>
        ///   </list>
        ///  <para>
        ///   <b>Load</b> accepts both "http://purl.oclc.org/dsdl/schematron" and "http://www.ascc.net/xml/schematron"
        ///   as valid namespaces.
        /// </para>
        /// </remarks>
        public void Load(string uri)
        {
            Reset();

             if (uri == null)
            throw new ArgumentNullException("uri");

            if (log.IsDebugEnabled)
            log.Debug("Loading " + uri);

            SchematronReader reader = new SchematronReader();
            using (XmlReader xmlReader = XmlReader.Create(uri, reader.CreateXmlReaderSettings()))
            {
            reader.ReadSchema(this, xmlReader, true);
            }
        }
Пример #4
0
        /// <summary>
        ///   Loads the <see cref="SchematronDocument"/> from the specified <see cref="Stream"/>.
        /// </summary>
        /// <param name="s">The <see cref="Stream"/> containing the document to load.</param>
        /// <remarks>
        ///   The following checks are performed on the document:
        ///   <list type="bullet">
        ///   <item>It is a well-formed XML document.</item>
        ///   <item>The <see cref="XmlDocument.DocumentElement"/> namespace is a <see cref="Schematron"/> namespace.</item>
        ///   <item>The document validates against the W3C XSD schema for a <see cref="SchematronDocument"/>.</item>
        ///   <item>The document validates against the Schematron schema for a <see cref="SchematronDocument"/>.</item>
        ///   </list>
        ///  <para>
        ///   <b>Load</b> accepts both "http://purl.oclc.org/dsdl/schematron" and "http://www.ascc.net/xml/schematron"
        ///   as valid namespaces.
        /// </para>
        /// </remarks>
        public void Load(Stream s)
        {
            Reset();

             if (s == null)
            throw new ArgumentNullException("s");

            SchematronReader reader = new SchematronReader();
            using (XmlReader xmlReader = XmlReader.Create(s, reader.CreateXmlReaderSettings()))
            {
            reader.ReadSchema(this, xmlReader, true);
            }
        }