// // System.Xml.XmlAttributeCollection // // Author: // Jason Diamond (jason@injektilo.org) // Atsushi Enomoto (ginga@kit.hi-ho.ne.jp) // // (C) 2002 Jason Diamond http://injektilo.org/ // (C) 2002 Atsushi Enomoto // // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using Mono.Xml; namespace System.Xml { #if NET_2_0 public sealed class XmlAttributeCollection : XmlNamedNodeMap, ICollection #else public class XmlAttributeCollection : XmlNamedNodeMap, ICollection #endif { XmlElement ownerElement; XmlDocument ownerDocument; internal XmlAttributeCollection (XmlNode parent) : base (parent) { ownerElement = parent as XmlElement; ownerDocument = parent.OwnerDocument; if(ownerElement == null) throw new XmlException ("invalid construction for XmlAttributeCollection."); } bool ICollection.IsSynchronized { get { return false; } } bool IsReadOnly { get { return ownerElement.IsReadOnly; } } [System.Runtime.CompilerServices.IndexerName ("ItemOf")] #if NET_2_0 public XmlAttribute this [string name] { #else public virtual XmlAttribute this [string name] { #endif get { return (XmlAttribute) GetNamedItem (name); } } [System.Runtime.CompilerServices.IndexerName ("ItemOf")] #if NET_2_0 public XmlAttribute this [int i] { #else public virtual XmlAttribute this [int i] { #endif get { return (XmlAttribute) Nodes [i]; } } [System.Runtime.CompilerServices.IndexerName ("ItemOf")] #if NET_2_0 public XmlAttribute this [string localName, string namespaceURI] { #else public virtual XmlAttribute this [string localName, string namespaceURI] { #endif get { return (XmlAttribute) GetNamedItem (localName, namespaceURI); } } object ICollection.SyncRoot { get { return this; } } #if NET_2_0 public XmlAttribute Append (XmlAttribute node) #else public virtual XmlAttribute Append (XmlAttribute node) #endif { SetNamedItem (node); return node; } public void CopyTo (XmlAttribute[] array, int index) { // assuming that Nodes is a correct collection. for(int i=0; i