예제 #1
0
        // internal constructor

        internal SchemaValidator(Processor processor)
        {
            this.config = processor.Implementation;
            Object obj = config.getConfigurationProperty(JFeatureKeys.USE_XSI_SCHEMA_LOCATION);

            useXsiSchemaLocation = ((java.lang.Boolean)obj).booleanValue();
            invalidityHandler    = new net.sf.saxon.lib.StandardInvalidityHandler(processor.Implementation);
        }
예제 #2
0
        /// <summary>
        /// Get the value of a configuration property
        /// </summary>
        /// <remarks>
        /// <para>This method provides the ability to get named properties of the configuration.
        /// The property names are supplied as strings, whose values can be found in the Java
        /// class <c>net.sf.saxon.FeatureKeys</c>. The property values are always returned as strings.
        /// Properties whose values are other types are returned by converting the value to a string.
        /// Note that on/off properties are returned using the strings "true" and "false".</para>
        /// <para><i>Method added in Saxon 9.1</i></para>
        /// </remarks>
        /// <param name="name">The property name</param>
        /// <returns>The property value, as a string; or null if the property is unset.</returns>

        public String GetProperty(String name)
        {
            Object obj = config.getConfigurationProperty(name);

            return(obj == null ? null : obj.ToString());
        }
예제 #3
0
        /// <summary>
        /// Resolve the specified targetNamespace, baseURI and locations.
        /// </summary>
        /// <param name="targetNamespace">Target namespace.</param>
        /// <param name="baseURI">BaseURI.</param>
        /// <param name="locations">Locations.</param>
        public Source[] resolve(String targetNamespace, String baseURI, String[] locations)
        {
            if (config.isSchemaAvailable(targetNamespace) && !(java.lang.Boolean.valueOf(((java.lang.Object)config.getConfigurationProperty(JFeatureKeys.MULTIPLE_SCHEMA_IMPORTS)).toString()).booleanValue()))
            {
                return(new Source[0]);
            }
            Uri baseU = (baseURI == null ? null : new Uri(baseURI));

            Uri[]          modules = resolver.GetSchemaDocuments(targetNamespace, baseU, locations);
            StreamSource[] ss      = new StreamSource[modules.Length];
            for (int i = 0; i < ss.Length; i++)
            {
                ss[i] = new StreamSource();
                ss[i].setSystemId(modules[i].ToString());
                Object doc = resolver.GetEntity(modules[i]);
                if (doc is Stream)
                {
                    ss[i].setInputStream(new JDotNetInputStream((Stream)doc));
                }
                else if (doc is String)
                {
                    ss[i].setReader(new JDotNetReader(new StringReader((String)doc)));
                }
                else
                {
                    throw new ArgumentException("Invalid response from GetEntity()");
                }
            }
            return(ss);
        }