The Catalog provides a configurable XmlResolver for an XML parser.
Inheritance: System.Xml.XmlResolver
        /// <summary>
        /// Resolve the location of the indicated <see cref="SchemaRelease"/> (and
        /// any that it imports) to the schema set using the given XML catalog to
        /// resolve the schema location.
        /// </summary>
        /// <param name="release">The <see cref="SchemaRelease"/> to be added.</param>
        /// <param name="catalog">The <see cref="Catalog"/> to resolve with.</param>
        public void Add(SchemaRelease release, Catalog catalog)
        {
            List<SchemaRelease>	imports = release.ImportSet;

            foreach (SchemaRelease schema in imports) {
                if (!schemas.Contains (schema)) {
                    Uri			uri = catalog.ResolveUri (null, schema.NamespaceUri);

                    if (uri != null) {
                        schemaSet.Add (schema.NamespaceUri, Unwrap (uri.LocalPath));
                        schemas.Add (schema);
                    }
                    else
                        log.Fatal ("Failed to resolve schema for '" + schema.NamespaceUri + "'");
                }
            }
        }
 /// <summary>
 /// Removes a <see cref="Catalog"/> from the collection.
 /// </summary>
 /// <param name="catalog">The <see cref="Catalog"/> to remove.</param>
 public void RemoveCatalog(Catalog catalog)
 {
     catalogs.Remove (catalog);
 }
 /// <summary>
 /// Adds a <see cref="Catalog"/> to the collection.
 /// </summary>
 /// <param name="catalog">The <see cref="Catalog"/> to add.</param>
 public void AddCatalog(Catalog catalog)
 {
     catalogs.Add (catalog);
 }
        /// <summary>
        /// Creates an <see cref="Catalog"/> instance from the definition held in
        /// the indicated URL. If the file has been requested previously then the
        /// cached object is returned.
        /// </summary>
        /// <param name="url">The catalog's URI.</param>
        /// <param name="validate">Determines if the catalog should be validated.</param>
        /// <returns>The <see cref="Catalog"/> instance created from the URL.</returns>
        public static Catalog Find(String url, bool validate)
        {
            if (catalogs.ContainsKey (url))
                return (catalogs [url]);

            Catalog 			catalog = null;
            XmlReader			reader	= new XmlTextReader (url);
            Stack<GroupEntry>	stack	= new Stack<GroupEntry> ();

            while (reader.Read ()) {
                if (reader.NodeType == XmlNodeType.Element) {
                    String localName = reader.LocalName;

                    if (localName.Equals ("catalog")) {
                        String prefer 		= reader.GetAttribute ("prefer");
                        String xmlbase		= reader.GetAttribute ("xml:base");

                        stack.Push ((catalog = new Catalog (url, prefer, xmlbase)).Definition);
                    }
                    else if (localName.Equals ("group")) {
                        String prefer 		= reader.GetAttribute ("prefer");
                        String xmlbase		= reader.GetAttribute ("xml:base");

                        stack.Push (catalog.Definition.AddGroup (prefer, xmlbase));
                    }
                    else {
                        GroupEntry group = stack.Peek ();

                        if (localName.Equals ("public")) {
                            String publicId 	= reader.GetAttribute ("publicId");
                            String uri 			= reader.GetAttribute ("uri");
                            String xmlbase		= reader.GetAttribute ("xml:base");

                            group.AddPublic (publicId, uri, xmlbase);
                        }
                        else if (localName.Equals ("system")) {
                            String systemId		= reader.GetAttribute ("systemId");
                            String uri			= reader.GetAttribute ("uri");
                            String xmlbase		= reader.GetAttribute ("xml:base");

                            group.AddSystem (systemId, uri, xmlbase);
                        }
                        else if (localName.Equals ("rewriteSystem")) {
                            String startString	= reader.GetAttribute ("systemIdStartString");
                            String rewritePrefix= reader.GetAttribute ("rewritePrefix");

                            group.AddRewriteSystem (startString, rewritePrefix);
                        }
                        else if (localName.Equals ("delegatePublic")) {
                            String startString	= reader.GetAttribute ("publicIdStartString");
                            String file			= reader.GetAttribute ("catalog");
                            String xmlbase		= reader.GetAttribute ("xml:base");

                            group.AddDelegatePublic (startString, file, xmlbase);
                        }
                        else if (localName.Equals ("delegateSystem")) {
                            String startString	= reader.GetAttribute ("systemIdStartString");
                            String file			= reader.GetAttribute ("catalog");
                            String xmlbase		= reader.GetAttribute ("xml:base");

                            group.AddDelegateSystem (startString, file, xmlbase);
                        }
                        else if (localName.Equals ("uri")) {
                            String name			= reader.GetAttribute ("name");
                            String uri			= reader.GetAttribute ("uri");
                            String xmlbase		= reader.GetAttribute ("xml:base");

                            group.AddUri (name, uri, xmlbase);
                        }
                        else if (localName.Equals ("rewriteUri")) {
                            String startString	= reader.GetAttribute ("uriStartString");
                            String rewritePrefix = reader.GetAttribute ("rewritePrefix");

                            group.AddRewriteUri (startString, rewritePrefix);
                        }
                        else if (localName.Equals ("delegateUri")) {
                            String startString	= reader.GetAttribute ("uriStartString");
                            String file			= reader.GetAttribute ("catalog");
                            String xmlbase		= reader.GetAttribute ("xml:base");

                            group.AddDelegateUri (startString, file, xmlbase);
                        }
                        else if (localName.Equals ("nextCatalog")) {
                            String file			= reader.GetAttribute ("catalog");
                            String xmlbase		= reader.GetAttribute ("xml:base");

                            group.AddNextCatalog (file, xmlbase);
                        }
                        else
                            throw new Exception ("Unexpected element tag in XML catalog file");
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement) {
                    String localName = reader.LocalName;

                    if (localName.Equals ("catalog") || localName.Equals ("group"))
                        stack.Pop ();
                }
            }
            reader.Close ();

            return (catalogs [url] = catalog);
        }