private static ElementMappingType GetElementMappingType (
XmlElement el, ArrayList ignoredNamespaces, Hashtable existingTables)
{
if (existingTables != null) {
ArrayList al = existingTables [el.NamespaceURI] as ArrayList;
if (al != null && al.Contains (el.LocalName))
// this is not precise, but it is enough
// for IsDocumentElementTable().
return ElementMappingType.Complex;
}
foreach (XmlAttribute attr in el.Attributes) {
if (attr.NamespaceURI == XmlConstants.XmlnsNS
#if NET_2_0
|| attr.NamespaceURI == XmlConstants.XmlNS
#endif
)
continue;
if (ignoredNamespaces != null && ignoredNamespaces.Contains (attr.NamespaceURI))
continue;
SetAsExistingTable (el, existingTables);
return ElementMappingType.Complex;
}
foreach (XmlNode n in el.ChildNodes) {
if (n.NodeType == XmlNodeType.Element) {
SetAsExistingTable (el, existingTables);
return ElementMappingType.Complex;
}
}
for (XmlNode n = el.NextSibling; n != null; n = n.NextSibling) {
if (n.NodeType == XmlNodeType.Element && n.LocalName == el.LocalName) {
SetAsExistingTable (el, existingTables);
return GetElementMappingType (n as XmlElement,
ignoredNamespaces, null)
== ElementMappingType.Complex ?
ElementMappingType.Complex :
ElementMappingType.Repeated;
}
}
return ElementMappingType.Simple;
}