public virtual object Create (object parent, object configContext, XmlNode section) {
			if (section.Attributes != null && section.Attributes.Count != 0)
				HandlersUtil.ThrowException ("Unrecognized attribute", section);

			ObjectNameResolversCollection col = new ObjectNameResolversCollection(parent as ObjectNameResolversCollection);

			XmlNodeList resolvers = section.ChildNodes;
			foreach (XmlNode child in resolvers) {
				XmlNodeType ntype = child.NodeType;
				if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
					continue;

				if (ntype != XmlNodeType.Element)
					HandlersUtil.ThrowException ("Only elements allowed", child);

				string dbname = HandlersUtil.ExtractAttributeValue ("dbname", child,false,true);
				string match = HandlersUtil.ExtractAttributeValue ("match", child);
				string pri = HandlersUtil.ExtractAttributeValue ("priority", child);

				ObjectNameResolver resolver = new ObjectNameResolver(dbname, match, int.Parse(pri));
				col.Add(resolver);
			}

			col.Sort();
			
			return col;
		}
        internal ObjectNameResolversCollection(ObjectNameResolversCollection parent)
        {
            _resolvers = new ArrayList();

            if (parent != null)
            {
                _resolvers.AddRange(parent);
            }
        }
Exemplo n.º 3
0
        public virtual object Create(object parent, object configContext, XmlNode section)
        {
            if (section.Attributes != null && section.Attributes.Count != 0)
            {
                HandlersUtil.ThrowException("Unrecognized attribute", section);
            }

            ObjectNameResolversCollection col = new ObjectNameResolversCollection(parent as ObjectNameResolversCollection);

            XmlNodeList resolvers = section.ChildNodes;

            foreach (XmlNode child in resolvers)
            {
                XmlNodeType ntype = child.NodeType;
                if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
                {
                    continue;
                }

                if (ntype != XmlNodeType.Element)
                {
                    HandlersUtil.ThrowException("Only elements allowed", child);
                }

                string dbname = HandlersUtil.ExtractAttributeValue("dbname", child, false, true);
                string match  = HandlersUtil.ExtractAttributeValue("match", child);
                string pri    = HandlersUtil.ExtractAttributeValue("priority", child);

                ObjectNameResolver resolver = new ObjectNameResolver(dbname, match, int.Parse(pri));
                col.Add(resolver);
            }

            col.Sort();

            return(col);
        }
		internal ObjectNameResolversCollection(ObjectNameResolversCollection parent) {
			_resolvers = new ArrayList();

			if (parent != null)
				_resolvers.AddRange(parent);
		}