System.Xml.XmlBinaryDictionaryReader.ReadNamespace C# (CSharp) Méthode

ReadNamespace() private méthode

private ReadNamespace ( byte ident ) : void
ident byte
Résultat void
		private void ReadNamespace (byte ident)
		{
			// create attrubute slot.
			if (attributes.Count == attr_count)
				attributes.Add (new AttrNodeInfo (this));
			AttrNodeInfo a = attributes [attr_count++];
			a.Reset ();
			a.Position = source.Position;

			string prefix = null, ns = null;
			XmlDictionaryString dns = null;

			switch (ident) {
			case BF.DefaultNSString:
				prefix = String.Empty;
				ns = ReadUTF8 ();
				break;
			case BF.PrefixNSString:
				prefix = ReadUTF8 ();
				ns = ReadUTF8 ();
				break;
			case BF.DefaultNSIndex:
				prefix = String.Empty;
				dns = ReadDictName ();
				ns_dict_store.Add (ns_store.Count, dns);
				ns = dns.Value;
				break;
			case BF.PrefixNSIndex:
				prefix = ReadUTF8 ();
				dns = ReadDictName ();
				ns_dict_store.Add (ns_store.Count, dns);
				ns = dns.Value;
				break;
			}

			// fill attribute slot.
			a.Prefix = prefix.Length > 0 ? "xmlns" : String.Empty;
			a.LocalName = prefix.Length > 0 ? prefix : "xmlns";
			a.NS = "http://www.w3.org/2000/xmlns/";
			a.ValueIndex = attr_value_count;
			if (attr_value_count == attr_values.Count)
				attr_values.Add (new NodeInfo (true));
			NodeInfo v = attr_values [attr_value_count++];
			v.Reset ();
			v.Value = ns;
			v.ValueType = BF.Chars8;
			v.NodeType = XmlNodeType.Text;

			ns_store.Add (new QName (prefix, ns));
			context.NamespaceManager.AddNamespace (prefix, ns);
		}