System.Data.XmlDataInferenceLoader.IsDocumentElementTable C# (CSharp) Метод

IsDocumentElementTable() статический приватный Метод

static private IsDocumentElementTable ( XmlElement top, ArrayList ignoredNamespaces ) : bool
top System.Xml.XmlElement
ignoredNamespaces System.Collections.ArrayList
Результат bool
		internal static bool IsDocumentElementTable (XmlElement top,
			ArrayList ignoredNamespaces)
		{
			foreach (XmlAttribute attr in top.Attributes) {
				if (attr.NamespaceURI == XmlConstants.XmlnsNS
#if NET_2_0
					|| attr.NamespaceURI == XmlConstants.XmlNS
#endif
					)
					continue;
				if (ignoredNamespaces != null &&
					ignoredNamespaces.Contains (attr.NamespaceURI))
					continue;
				// document element has attributes other than xmlns
				return true;
			}
			Hashtable existingTables = new Hashtable ();
			foreach (XmlNode n in top.ChildNodes) {
				XmlElement el = n as XmlElement;
				if (el == null)
					continue;
				if (GetElementMappingType (el, ignoredNamespaces,
					existingTables)
					== ElementMappingType.Simple)
					return true;
			}
			return false;
		}

Same methods

XmlDataInferenceLoader::IsDocumentElementTable ( ) : bool

Usage Example

Пример #1
0
        private bool IsTopLevelDataSet()
        {
            string local = XmlHelper.Decode(reader.LocalName);

            // No need to check DataSetName. In fact, it is ignored.

            DataTable dt = dataset.Tables [local];

            if (dt == null)
            {
                return(true);
            }

            XmlDocument doc = new XmlDocument();
            XmlElement  el  = (XmlElement)doc.ReadNode(reader);

            doc.AppendChild(el);
            reader = new XmlNodeReader(el);
            reader.MoveToContent();

            return(!XmlDataInferenceLoader.IsDocumentElementTable(
                       el, null));
        }