2002-03-12 Duncan Mak <duncan@ximian.com>
[mono.git] / mcs / class / System.XML / System.Xml / XmlNamedNodeMap.cs
1 //
2 // System.Xml.XmlNamedNodeMap
3 //
4 // Author:
5 //   Jason Diamond (jason@injektilo.org)
6 //   Duncan Mak  (duncan@ximian.com)
7 //
8 // (C) 2002 Jason Diamond  http://injektilo.org/
9 //
10
11 using System;
12 using System.Collections;
13
14 namespace System.Xml
15 {
16         public class XmlNamedNodeMap : IEnumerable
17         {
18                 private XmlNode parent;
19                 private ArrayList nodeList;
20
21                 internal XmlNamedNodeMap (XmlNode parent)
22                 {
23                         this.parent = parent;
24                         nodeList = new ArrayList ();
25                 }
26
27                 public virtual int Count {
28                         get { return nodeList.Count; }
29                 }
30
31                 [MonoTODO]
32                 public virtual IEnumerator GetEnumerator () 
33                 {
34                         throw new NotImplementedException ();
35                 }
36
37                 public virtual XmlNode GetNamedItem (string name)
38                 {
39                         foreach (XmlNode node in nodeList) {
40                                 if (node.Name == name)
41                                         return node;
42                         }
43                         return null;
44                 }
45
46                 [MonoTODO]
47                 public virtual XmlNode GetNamedItem (string localName, string namespaceURI)
48                 {
49                         throw new NotImplementedException ();
50                 }
51                 
52                 public virtual XmlNode Item (int index)
53                 {
54                         if (index < 0 || index > nodeList.Count)
55                                 return null;
56                         else
57                                 return (XmlNode) nodeList [index];
58                 }
59
60                 [MonoTODO]
61                 public virtual XmlNode RemoveNamedItem (string name)
62                 {
63                         throw new NotImplementedException ();
64                 }
65
66                 [MonoTODO]
67                 public virtual XmlNode RemoveNamedItem (string localName, string namespaceURI)
68                 {
69                         throw new NotImplementedException ();
70                 }
71
72                 [MonoTODO]
73                 public virtual XmlNode SetNamedItem (XmlNode node)
74                 {
75                         nodeList.Add (node);
76                         return node;
77                 }
78         }
79 }