| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //
- // XmlSerializerNamespaces.cs:
- //
- // Author:
- // John Donagher ([email protected])
- //
- // (C) 2002 John Donagher
- //
- using System;
- using System.Xml;
- using System.Collections;
- namespace System.Xml.Serialization
- {
- /// <summary>
- /// Summary description for XmlSerializerNamespaces.
- /// </summary>
- public class XmlSerializerNamespaces
- {
- private Hashtable namespaces;
-
- public XmlSerializerNamespaces ()
- {
- namespaces = new Hashtable ();
- }
-
- public XmlSerializerNamespaces(XmlQualifiedName[] namespaces)
- : this()
- {
- foreach(XmlQualifiedName qname in namespaces)
- {
- this.namespaces[qname.Name] = qname;
- }
- }
-
- public XmlSerializerNamespaces(XmlSerializerNamespaces namespaces)
- : this(namespaces.ToArray())
- {}
-
- public void Add (string prefix, string ns)
- {
- XmlQualifiedName qname = new XmlQualifiedName(prefix,ns);
- namespaces[qname.Name] = qname;
- }
-
- public XmlQualifiedName[] ToArray ()
- {
- XmlQualifiedName[] array = new XmlQualifiedName[namespaces.Count];
- namespaces.Values.CopyTo(array,0);
- return array;
- }
-
- public int Count
- {
- get{ return namespaces.Count; }
- }
- internal string GetPrefix(string Ns)
- {
- foreach(string prefix in namespaces.Keys)
- {
- if(Ns == ((XmlQualifiedName)namespaces[prefix]).Namespace)
- return prefix;
- }
- return null;
- }
- internal Hashtable Namespaces
- {
- get {
- return namespaces;
- }
- }
- }
- }
|