Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ReadXmlSchema() [4/5]

void System.Data.DataSet.ReadXmlSchema ( XmlReader reader,
bool denyResolving )
inlinepackage

Definition at line 1381 of file DataSet.cs.

1382 {
1383 long scopeId = DataCommonEventSource.Log.EnterScope("<ds.DataSet.ReadXmlSchema|INFO> {0}, reader, denyResolving={1}", ObjectID, denyResolving);
1384 try
1385 {
1386 int depth = -1;
1387 if (reader == null)
1388 {
1389 return;
1390 }
1391 if (reader is XmlTextReader)
1392 {
1393 ((XmlTextReader)reader).WhitespaceHandling = WhitespaceHandling.None;
1394 }
1396 if (reader.NodeType == XmlNodeType.Element)
1397 {
1398 depth = reader.Depth;
1399 }
1400 reader.MoveToContent();
1401 if (reader.NodeType != XmlNodeType.Element)
1402 {
1403 return;
1404 }
1405 if (reader.LocalName == "Schema" && reader.NamespaceURI == "urn:schemas-microsoft-com:xml-data")
1406 {
1407 ReadXDRSchema(reader);
1408 return;
1409 }
1410 if (reader.LocalName == "schema" && reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
1411 {
1413 return;
1414 }
1415 if (reader.LocalName == "schema" && reader.NamespaceURI.StartsWith("http://www.w3.org/", StringComparison.Ordinal))
1416 {
1417 throw ExceptionBuilder.DataSetUnsupportedSchema("http://www.w3.org/2001/XMLSchema");
1418 }
1419 XmlElement xmlElement = xmlDocument.CreateElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
1420 if (reader.HasAttributes)
1421 {
1422 int attributeCount = reader.AttributeCount;
1423 for (int i = 0; i < attributeCount; i++)
1424 {
1425 reader.MoveToAttribute(i);
1426 if (reader.NamespaceURI.Equals("http://www.w3.org/2000/xmlns/"))
1427 {
1428 xmlElement.SetAttribute(reader.Name, reader.GetAttribute(i));
1429 continue;
1430 }
1431 XmlAttribute xmlAttribute = xmlElement.SetAttributeNode(reader.LocalName, reader.NamespaceURI);
1432 xmlAttribute.Prefix = reader.Prefix;
1433 xmlAttribute.Value = reader.GetAttribute(i);
1434 }
1435 }
1436 reader.Read();
1437 while (MoveToElement(reader, depth))
1438 {
1439 if (reader.LocalName == "Schema" && reader.NamespaceURI == "urn:schemas-microsoft-com:xml-data")
1440 {
1441 ReadXDRSchema(reader);
1442 return;
1443 }
1444 if (reader.LocalName == "schema" && reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
1445 {
1447 return;
1448 }
1449 if (reader.LocalName == "schema" && reader.NamespaceURI.StartsWith("http://www.w3.org/", StringComparison.Ordinal))
1450 {
1451 throw ExceptionBuilder.DataSetUnsupportedSchema("http://www.w3.org/2001/XMLSchema");
1452 }
1453 XmlNode newChild = xmlDocument.ReadNode(reader);
1454 xmlElement.AppendChild(newChild);
1455 }
1456 ReadEndElement(reader);
1457 xmlDocument.AppendChild(xmlElement);
1458 InferSchema(xmlDocument, null, XmlReadMode.Auto);
1459 }
1460 finally
1461 {
1462 DataCommonEventSource.Log.ExitScope(scopeId);
1463 }
1464 }
void ReadXDRSchema(XmlReader reader)
Definition DataSet.cs:1532
void ReadXSDSchema(XmlReader reader, bool denyResolving)
Definition DataSet.cs:1500
void ReadEndElement(XmlReader reader)
Definition DataSet.cs:1483
bool MoveToElement(XmlReader reader, int depth)
Definition DataSet.cs:1466
string? GetAttribute(string name)
bool MoveToAttribute(string name)
virtual bool HasAttributes
Definition XmlReader.cs:124
virtual XmlNodeType MoveToContent()
Definition XmlReader.cs:604
XmlNodeType NodeType
Definition XmlReader.cs:62
virtual string Name
Definition XmlReader.cs:65

References System.Xml.XmlReader.AttributeCount, System.Data.ExceptionBuilder.DataSetUnsupportedSchema(), System.Xml.XmlReader.Depth, System.Runtime.Serialization.Dictionary, System.Xml.XmlReader.GetAttribute(), System.Xml.XmlReader.HasAttributes, System.Data.InferSchema, System.Xml.XmlReader.LocalName, System.Data.DataCommonEventSource.Log, System.Xml.XmlReader.MoveToAttribute(), System.Xml.XmlReader.MoveToContent(), System.Data.DataSet.MoveToElement(), System.Xml.XmlReader.Name, System.Xml.XmlReader.NamespaceURI, System.Xml.XmlReader.NodeType, System.Data.DataSet.ObjectID, System.Xml.XmlReader.Prefix, System.Xml.XmlReader.Read(), System.Data.DataSet.ReadEndElement(), System.Data.DataSet.ReadXDRSchema(), and System.Data.DataSet.ReadXSDSchema().