System.Xml.DataSetMapper.SearchMatchingTableSchema C# (CSharp) Méthode

SearchMatchingTableSchema() private méthode

private SearchMatchingTableSchema ( XmlBoundElement rowElem, XmlBoundElement elem ) : DataTable
rowElem XmlBoundElement
elem XmlBoundElement
Résultat System.Data.DataTable
        internal DataTable SearchMatchingTableSchema(XmlBoundElement rowElem, XmlBoundElement elem)
        {
            Debug.Assert(elem != null);

            DataTable t = SearchMatchingTableSchema(elem.LocalName, elem.NamespaceURI);
            if (t == null)
            {
                return null;
            }

            if (rowElem == null)
            {
                return t;
            }

            // Currently we expect we map things from top of the tree to the bottom
            Debug.Assert(rowElem.Row != null);

            DataColumn col = GetColumnSchemaForNode(rowElem, elem);
            if (col == null)
            {
                return t;
            }

            foreach (XmlAttribute a in elem.Attributes)
            {
#if DEBUG
                // Some sanity check to catch errors like namespace attributes have the right localName/namespace value, but a wrong atomized namespace value
                if (a.LocalName == "xmlns")
                {
                    Debug.Assert(a.Prefix != null && a.Prefix.Length == 0);
                    Debug.Assert(a.NamespaceURI == (object)strReservedXmlns);
                }
                if (a.Prefix == "xmlns")
                {
                    Debug.Assert(a.NamespaceURI == (object)strReservedXmlns);
                }
                if (a.NamespaceURI == strReservedXmlns)
                {
                    Debug.Assert(a.NamespaceURI == (object)strReservedXmlns);
                }
#endif
                // No namespace attribute found, so elem cannot be a potential DataColumn, therefore is a row-elem
                if (a.NamespaceURI != (object)strReservedXmlns)
                {
                    return t;
                }
            }

            for (XmlNode n = elem.FirstChild; n != null; n = n.NextSibling)
            {
                if (n.NodeType == XmlNodeType.Element)
                {
                    // elem has an element child, so elem cannot be a potential DataColumn, therefore is a row-elem
                    return t;
                }
            }

            // Node is a potential DataColumn in rowElem region
            return null;
        }

Same methods

DataSetMapper::SearchMatchingTableSchema ( string localName, string namespaceURI ) : DataTable