Ejemplo n.º 1
0
        /// <summary>
        ///   Reads a Schematron document and returns its object representation.
        /// </summary>
        /// <param name="uri">
        ///   The URI of the schematron document.
        /// </param>
        /// <returns>
        ///   A <see cref="SchematronDocument"/>
        /// </returns>
        /// <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 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>ReadSchematron</b> accepts both "http://purl.oclc.org/dsdl/schematron" and "http://www.ascc.net/xml/schematron"
        ///   as valid namespaces.
        /// </para>
        /// </remarks>
        public static SchematronDocument ReadSchematron(string uri)
        {
            if (log.IsInfoEnabled)
            log.Info("Reading " + uri);

            SchematronDocument doc = new SchematronDocument();
            doc.Load(uri);
            return doc;
        }
Ejemplo n.º 2
0
        SchematronDocument LoadSchematron(string name, bool schematronValidation)
        {
            if (log.IsInfoEnabled)
            log.Info("Loading " + name);

             XmlDocument xml = new XmlDocument();
             Assembly asm = Assembly.GetExecutingAssembly();
             using (Stream s = asm.GetManifestResourceStream(name))
             {
            if (s == null)
               throw new Exception(String.Format("The resource '{0}' is missing.", name));

               SchematronDocument doc = new SchematronDocument();
               doc.Load(s, schematronValidation);
               return doc;
             }
        }