The GroupEntry class provides a container for other catalog components.
Inheritance: RelativeEntry
 /// <summary>
 /// Constructs a <b>RewriteSystem</b> instance that will replace
 /// the prefix of system identifier with another.
 /// </summary>
 /// <param name="parent">The containing catalog element.</param>
 /// <param name="oldPrefix">The system identifier to be matched.</param>
 /// <param name="newPrefix">The replacement prefix.</param>
 public RewriteSystemEntry(GroupEntry parent, String oldPrefix,
                           String newPrefix)
     : base(parent)
 {
     this.oldPrefix = oldPrefix;
     this.newPrefix = newPrefix;
 }
 /// <summary>
 /// Constructs a <b>UriEntry</b> instance that will replace
 /// one URI with another.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="name">URI to be matched.</param>
 /// <param name="uri">The replacement URI.</param>
 /// <param name="xmlbase">Optional <CODE>xml:base</CODE> value.</param>
 public UriEntry(GroupEntry parent, String name, String uri,
                 String xmlbase)
     : base(parent, xmlbase)
 {
     this.name = name;
     this.uri  = uri;
 }
 /// <summary>
 /// Constructs a <b>PublicEntry</b> instance that will replace
 /// a public identifier with a URI.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="publicId">The public identifier to be matched</param>
 /// <param name="uri">The replacement URI.</param>
 /// <param name="xmlbase">The optional xml:base URI</param>
 public PublicEntry(GroupEntry parent, String publicId,
     String uri, String xmlbase)
     : base(parent, xmlbase)
 {
     this.publicId = publicId;
     this.uri      = uri;
 }
 /// <summary>
 /// Constructs a <b>RewriteSystem</b> instance that will replace
 /// the prefix of system identifier with another.
 /// </summary>
 /// <param name="parent">The containing catalog element.</param>
 /// <param name="oldPrefix">The system identifier to be matched.</param>
 /// <param name="newPrefix">The replacement prefix.</param>
 public RewriteSystemEntry(GroupEntry parent, String oldPrefix,
     String newPrefix)
     : base(parent)
 {
     this.oldPrefix = oldPrefix;
     this.newPrefix = newPrefix;
 }
 /// <summary>
 /// Constructs a <b>DelegatePublic</b> instance that will direct
 /// matching public identifier searches to a sub-catalog.
 /// </summary>
 /// <param name="parent">The containing catalog element.</param>
 /// <param name="prefix">The system identifier to be matched.</param>
 /// <param name="catalog">The URI of the sub-catalog.</param>
 /// <param name="xmlbase">The optional xml:base URI</param>
 public DelegatePublicEntry(GroupEntry parent, String prefix,
     String catalog, String xmlbase)
     : base(parent, xmlbase)
 {
     this.prefix  = prefix;
     this.catalog = catalog;
 }
Example #6
0
 /// <summary>
 /// Constructs a <b>PublicEntry</b> instance that will replace
 /// a public identifier with a URI.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="publicId">The public identifier to be matched</param>
 /// <param name="uri">The replacement URI.</param>
 /// <param name="xmlbase">The optional xml:base URI</param>
 public PublicEntry(GroupEntry parent, String publicId,
                    String uri, String xmlbase)
     : base(parent, xmlbase)
 {
     this.publicId = publicId;
     this.uri      = uri;
 }
 /// <summary>
 /// Constructs a <b>UriEntry</b> instance that will replace
 /// one URI with another.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="name">URI to be matched.</param>
 /// <param name="uri">The replacement URI.</param>
 /// <param name="xmlbase">Optional <CODE>xml:base</CODE> value.</param>
 public UriEntry(GroupEntry parent, String name, String uri,
     String xmlbase)
     : base(parent, xmlbase)
 {
     this.name = name;
     this.uri  = uri;
 }
 /// <summary>
 /// Constructs a <b>SystemEntry</b> instance that will replace
 /// a system identifier with a URI.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="systemId">The system identifier to be matched.</param>
 /// <param name="uri">The replacement URI.</param>
 /// <param name="xmlbase">Optional <CODE>xml:base</CODE> value.</param>
 public SystemEntry(GroupEntry parent, String systemId,
     String uri, String xmlbase)
     : base(parent, xmlbase)
 {
     this.systemId = systemId;
     this.uri      = uri;
 }
Example #9
0
 /// <summary>
 /// Constructs a <b>DelegateSystem</b> instance that will direct
 /// matching system identifier searches to a sub-catalog.
 /// </summary>
 /// <param name="parent">The containing catalog element.</param>
 /// <param name="prefix">The system identifier to be matched.</param>
 /// <param name="catalog">The URI of the sub-catalog.</param>
 /// <param name="xmlbase">The optional xml:base URI</param>
 public DelegateSystemEntry(GroupEntry parent, String prefix,
                            String catalog, String xmlbase)
     : base(parent, xmlbase)
 {
     this.prefix  = prefix;
     this.catalog = catalog;
 }
        /// <summary>
        /// Adds a group entry to the catalog.
        /// </summary>
        /// <param name="prefer">Optional <b>prefer</b> value.</param>
        /// <param name="xmlbase">Optional <b>xml:base</b> value.</param>
        /// <returns>The constructed <see cref="GroupEntry"/> instance.</returns>
        public GroupEntry AddGroup(String prefer, String xmlbase)
        {
            GroupEntry		result = new GroupEntry (this, prefer, xmlbase);

            rules.Add (result);
            return (result);
        }
        /// <summary>
        /// Adds a group entry to the catalog.
        /// </summary>
        /// <param name="prefer">Optional <b>prefer</b> value.</param>
        /// <param name="xmlbase">Optional <b>xml:base</b> value.</param>
        /// <returns>The constructed <see cref="GroupEntry"/> instance.</returns>
        public GroupEntry AddGroup(String prefer, String xmlbase)
        {
            GroupEntry result = new GroupEntry(this, prefer, xmlbase);

            rules.Add(result);
            return(result);
        }
 /// <summary>
 /// Constructs a <b>SystemEntry</b> instance that will replace
 /// a system identifier with a URI.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="systemId">The system identifier to be matched.</param>
 /// <param name="uri">The replacement URI.</param>
 /// <param name="xmlbase">Optional <CODE>xml:base</CODE> value.</param>
 public SystemEntry(GroupEntry parent, String systemId,
                    String uri, String xmlbase)
     : base(parent, xmlbase)
 {
     this.systemId = systemId;
     this.uri      = uri;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="startString"></param>
 /// <param name="catalog"></param>
 /// <param name="xmlbase"></param>
 public DelegateUriEntry(GroupEntry parent, String startString, String catalog, String xmlbase)
     : base(parent, xmlbase)
 {
     this.startString = startString;
     this.catalog     = catalog;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="startString"></param>
 /// <param name="catalog"></param>
 /// <param name="xmlbase"></param>
 public DelegateUriEntry(GroupEntry parent, String startString, String catalog, String xmlbase)
     : base(parent, xmlbase)
 {
     this.startString  = startString;
     this.catalog = catalog;
 }
 /// <summary>
 /// Constructs a <b>CatalogComponent</b> instance.
 /// </summary>
 /// <param name="parent">The containing catalog element.</param>
 protected CatalogComponent(GroupEntry parent)
 {
     this.parent = parent;
 }
 /// <summary>
 /// Constructs a <b>GroupEntry</b> given its containing entry
 /// and attribute values.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="prefer">Optional <b>prefer</b> value.</param>
 /// <param name="xmlbase">Optional <b>xml:base</b> value.</param>
 public GroupEntry(GroupEntry parent, String prefer, String xmlbase)
     : base(parent, xmlbase)
 {
     this.prefer = prefer;
 }
 /// <summary>
 /// Constructs a <b>CatalogComponent</b> instance.
 /// </summary>
 /// <param name="parent">The containing catalog element.</param>
 protected CatalogComponent(GroupEntry parent)
 {
     this.parent = parent;
 }
Example #18
0
 /// <summary>
 /// Constructs a <CODE>NextCatalogEntry</CODE> instance that will direct
 /// searches to another catalog.
 /// </summary>
 /// <param name="parent">The containing component.</param>
 /// <param name="catalog">The URI of the chained catalog.</param>
 /// <param name="xmlbase">The optional xml:base URI</param>
 public NextCatalogEntry(GroupEntry parent, String catalog,
                         String xmlbase)
     : base(parent, xmlbase)
 {
     this.catalog = catalog;
 }
 /// <summary>
 /// Constructs a <b>RewriteUriEntry</b>.
 /// </summary>
 /// <param name="parent">parent</param>
 /// <param name="startString">startString</param>
 /// <param name="rewritePrefix">rewritePrefix</param>
 public RewriteUriEntry(GroupEntry parent, String startString, String rewritePrefix)
     : base(parent)
 {
     this.startString   = startString;
     this.rewritePrefix = rewritePrefix;
 }
Example #20
0
        /// <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);
        }
 /// <summary>
 /// Constructs a <b>RelativeEntry</b> with holds the base URI used
 /// to resolve any local URI values.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="xmlbase">Optional <b>xml:base</b> value.</param>
 protected RelativeEntry(GroupEntry parent, String xmlbase)
     : base(parent)
 {
     this.xmlbase = xmlbase;
 }
 /// <summary>
 /// Constructs a <b>RewriteUriEntry</b>.
 /// </summary>
 /// <param name="parent">parent</param>
 /// <param name="startString">startString</param>
 /// <param name="rewritePrefix">rewritePrefix</param>
 public RewriteUriEntry(GroupEntry parent, String startString, String rewritePrefix)
     : base(parent)
 {
     this.startString   = startString;
     this.rewritePrefix = rewritePrefix;
 }
 /// <summary>
 /// Constructs a <b>GroupEntry</b> given its containing entry
 /// and attribute values.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="prefer">Optional <b>prefer</b> value.</param>
 /// <param name="xmlbase">Optional <b>xml:base</b> value.</param>
 public GroupEntry(GroupEntry parent, String prefer, String xmlbase)
     : base(parent, xmlbase)
 {
     this.prefer = prefer;
 }
Example #24
0
 /// <summary>
 /// Constructs a <b>RelativeEntry</b> with holds the base URI used
 /// to resolve any local URI values.
 /// </summary>
 /// <param name="parent">The containing element.</param>
 /// <param name="xmlbase">Optional <b>xml:base</b> value.</param>
 protected RelativeEntry(GroupEntry parent, String xmlbase)
     : base(parent)
 {
     this.xmlbase = xmlbase;
 }
 /// <summary>
 /// Constructs a <CODE>NextCatalogEntry</CODE> instance that will direct
 /// searches to another catalog.
 /// </summary>
 /// <param name="parent">The containing component.</param>
 /// <param name="catalog">The URI of the chained catalog.</param>
 /// <param name="xmlbase">The optional xml:base URI</param>
 public NextCatalogEntry(GroupEntry parent, String catalog,
     String xmlbase)
     : base(parent, xmlbase)
 {
     this.catalog = catalog;
 }