Exemple #1
0
        public Source[] resolve(String targetNamespace, String baseURI, String[] locations)
        {
            if (config.isSchemaAvailable(targetNamespace))
            {
                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 DotNetInputStream((Stream)doc));
                }
                else if (doc is String)
                {
                    ss[i].setReader(new DotNetReader(new StringReader((String)doc)));
                }
                else
                {
                    throw new ArgumentException("Invalid response from GetEntity()");
                }
            }
            return(ss);
        }
Exemple #2
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 DotNetInputStream((Stream)doc));
                }
                else if (doc is String)
                {
                    ss[i].setReader(new DotNetReader(new StringReader((String)doc)));
                }
                else
                {
                    throw new ArgumentException("Invalid response from GetEntity()");
                }
            }
            return(ss);
        }