System.Data.XmlSchemaWriter.WriteTableAttributes C# (CSharp) Method

WriteTableAttributes() private method

private WriteTableAttributes ( ArrayList atts ) : void
atts System.Collections.ArrayList
return void
		private void WriteTableAttributes (ArrayList atts)
		{
			//Then a list of attributes
			foreach (DataColumn col in atts) {
				w.WriteStartElement ("xs", "attribute", xmlnsxs);

				string name = XmlHelper.Encode (col.ColumnName);
				if (col.Namespace != String.Empty) {
					w.WriteAttributeString ("form", "qualified");
					string prefix = col.Prefix == String.Empty ? "app" + additionalNamespaces.Count : col.Prefix;
					name = prefix + ":" + name;
					// FIXME: Handle prefix mapping correctly.
					additionalNamespaces [prefix] = col.Namespace;
				}
				w.WriteAttributeString ("name", name);

				AddExtendedPropertyAttributes (
					col.ExtendedProperties);

				if (col.ReadOnly)
					w.WriteAttributeString (
						XmlConstants.MsdataPrefix,
						XmlConstants.ReadOnly,
						XmlConstants.MsdataNamespace,
						"true");

				if (col.MaxLength < 0) {
					// otherwise simpleType is written later
					w.WriteStartAttribute ("type", String.Empty);
					WriteQName (MapType (col.DataType));
					w.WriteEndAttribute ();
				}

				if (!col.AllowDBNull)
					w.WriteAttributeString ("use", "required");
				if (col.DefaultValue != DataColumn.GetDefaultValueForType (col.DataType))
					w.WriteAttributeString ("default",
						DataSet.WriteObjectXml (col.DefaultValue));

				if (col.MaxLength > -1)
					WriteSimpleType (col);

				w.WriteEndElement (); // attribute
			}
		}