private void LoadRows(DataRow parentRow, XmlNode parentElement)
{
if (parentElement == null)
return;
// Skip schema node as well
if (parentElement.LocalName == Keywords.XSD_SCHEMA && parentElement.NamespaceURI == Keywords.XSDNS ||
parentElement.LocalName == Keywords.SQL_SYNC && parentElement.NamespaceURI == Keywords.UPDGNS ||
parentElement.LocalName == Keywords.XDR_SCHEMA && parentElement.NamespaceURI == Keywords.XDRNS)
return;
for (XmlNode n = parentElement.FirstChild; n != null; n = n.NextSibling)
{
if (n is XmlElement)
{
XmlElement e = (XmlElement)n;
object schema = _nodeToSchemaMap.GetSchemaForNode(e, FIgnoreNamespace(e));
if (schema != null && schema is DataTable)
{
DataRow r = GetRowFromElement(e);
if (r == null)
{
// skip columns which has the same name as another table
if (parentRow != null && FColumnElement(e))
continue;
r = ((DataTable)schema).CreateEmptyRow();
_nodeToRowMap[e] = r;
// get all field values.
LoadRowData(r, e);
}
// recurse down to inner elements
LoadRows(r, n);
}
else
{
// recurse down to inner elements
LoadRows(null, n);
}
}
}
}