1241 {
1242 string localName = ((
col.ColumnMapping != MappingType.Element) ?
"attribute" :
"element");
1245 if (
col.Namespace.Length == 0)
1246 {
1247 DataTable table =
col.Table;
1250 {
1251 xmlElement.SetAttribute(
"form",
"unqualified");
1252 }
1253 }
1254 if (
col.GetType() !=
typeof(DataColumn))
1255 {
1257 }
1258 else
1259 {
1261 }
1264 if (
col.ColumnMapping == MappingType.Hidden)
1265 {
1266 if (!
col.AllowDBNull)
1267 {
1268 xmlElement.SetAttribute(
"AllowDBNull",
"urn:schemas-microsoft-com:xml-msdata",
"false");
1269 }
1270 if (!
col.DefaultValueIsNull)
1271 {
1273 {
1274 xmlElement.SetAttribute(
"DefaultValue",
"urn:schemas-microsoft-com:xml-msdata", ((
bool)
col.DefaultValue) ?
"true" :
"false");
1275 }
1276 else
1277 {
1279 xmlElement.SetAttribute(
"DefaultValue",
"urn:schemas-microsoft-com:xml-msdata",
col.ConvertObjectToXml(
col.DefaultValue));
1280 }
1281 }
1282 }
1283 if (!
col.DefaultValueIsNull &&
col.ColumnMapping != MappingType.Hidden)
1284 {
1286 if (
col.ColumnMapping == MappingType.Attribute && !
col.AllowDBNull)
1287 {
1289 {
1290 xmlElement.SetAttribute(
"DefaultValue",
"urn:schemas-microsoft-com:xml-msdata", ((
bool)
col.DefaultValue) ?
"true" :
"false");
1291 }
1292 else
1293 {
1294 xmlElement.SetAttribute(
"DefaultValue",
"urn:schemas-microsoft-com:xml-msdata",
col.ConvertObjectToXml(
col.DefaultValue));
1295 }
1296 }
1298 {
1299 xmlElement.SetAttribute(
"default", ((
bool)
col.DefaultValue) ?
"true" :
"false");
1300 }
1301 else if (!
col.IsCustomType)
1302 {
1303 xmlElement.SetAttribute(
"default",
col.ConvertObjectToXml(
col.DefaultValue));
1304 }
1305 }
1307 {
1308 xmlElement.SetAttribute(
"targetNamespace",
"urn:schemas-microsoft-com:xml-msdata",
col.Namespace);
1309 }
1311 {
1314 {
1316 }
1320 {
1322 }
1323 }
1324 int num = ((!
col.AllowDBNull) ? 1 : 0);
1325 if (
col.ColumnMapping == MappingType.Attribute && num != 0)
1326 {
1328 }
1329 if (
col.ColumnMapping == MappingType.Hidden)
1330 {
1331 xmlElement.SetAttribute(
"use",
"prohibited");
1332 }
1333 else if (
col.ColumnMapping != MappingType.Attribute && num != 1)
1334 {
1336 }
1338 {
1340 }
1342 }
static void ValidateColumnMapping(Type columnType)
void HandleColumnType(DataColumn col, XmlDocument dc, XmlElement root, XmlElement schema)
XmlElement GetSchema(string NamespaceURI)
void AddXdoProperties(object instance, XmlElement root, XmlDocument xd)
void AddColumnProperties(DataColumn col, XmlElement root)
readonly SchemaFormat _schFormat
static void AddExtendedProperties(PropertyCollection props, XmlElement node)
XmlElement FindTypeNode(XmlElement node, string strType)
string FindTargetNamespace(DataTable table)
static CultureInfo InvariantCulture
XmlElement CreateElement(string name)
virtual void SetAttribute(string name, string? value)