Пример #1
0
 // ----------------------------------------------------------------------------------------
 /// <!-- SchemaSet -->
 /// <summary>
 ///      Converts a schema into a schema set
 /// </summary>
 /// <param name="schemaFile"></param>
 /// <param name="hint1"></param>
 /// <param name="hint2"></param>
 /// <returns></returns>
 public static XmlSchemaSet SchemaSet(string schemaFile, string hint1, string hint2)
 {
     return(SchemaSet(PathSlicer.FindPath(schemaFile, hint1, hint2)));
 }
Пример #2
0
        // ----------------------------------------------------------------------------------------
        /// <!-- _Load_simple -->
        /// <summary>
        ///      A load that tries a few places to load an xml schema from
        /// </summary>
        /// <param name="newXml"></param>
        /// <param name="schemaLocation"></param>
        /// <returns></returns>
        public string _Load_simple(string schemaLocation, string hint1, string hint2, string hint3)
        {
            if (Regex.IsMatch(schemaLocation, ":"))
            {
                throw new FormatException("There should not be a : in the path " + schemaLocation);
            }


            string whereFound = "";


            PathSet paths = new PathSet();


            string tryHere = PathSlicer.FindPath(schemaLocation, hint1, hint2);

            try { whereFound = _Load(_baseLocation, schemaLocation); SetBaseLocation = whereFound; } catch {
                try { whereFound = _Load(tryHere);                       SetBaseLocation = whereFound; } catch {
                    try { whereFound = _Load("", schemaLocation); SetBaseLocation = whereFound; } catch {
                    }
                }
            }


            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, "");
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint1);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint1 + "\\" + hint2);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint2);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint2 + "\\" + hint1);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint1 + "\\" + hint2 + "\\" + hint3);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint2 + "\\" + hint3);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint3);
            }


            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint1 + "\\" + hint3);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint3 + "\\" + hint1);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint3 + "\\" + hint2);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint1 + "\\" + hint3 + "\\" + hint2);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint2 + "\\" + hint1 + "\\" + hint3);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint2 + "\\" + hint3 + "\\" + hint1);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint3 + "\\" + hint1 + "\\" + hint2);
            }
            if (string.IsNullOrEmpty(whereFound))
            {
                whereFound = TryLoad(schemaLocation, hint3 + "\\" + hint2 + "\\" + hint1);
            }


            return(whereFound);
        }