diff --git a/DataTableConverter/Assisstant/importers/XmlImporter.cs b/DataTableConverter/Assisstant/importers/XmlImporter.cs index 53f8c62..aa12914 100644 --- a/DataTableConverter/Assisstant/importers/XmlImporter.cs +++ b/DataTableConverter/Assisstant/importers/XmlImporter.cs @@ -33,6 +33,12 @@ internal static void Import(string path, DatabaseHelper databaseHelper, Progress XmlReader reader = XmlReader.Create(path, settings); reader.Read(); + // skip header information + if(reader.NodeType == XmlNodeType.XmlDeclaration) + { + reader.Read(); + } + // read static columns if (reader.HasAttributes) { @@ -83,7 +89,8 @@ internal static HashSet LoadRowData(XmlReader rowReader, Dictionary newCols = new HashSet(); string rowElementName = rowReader.LocalName; - if(rowReader.NodeType == XmlNodeType.EndElement) + bool isEmptyElement = rowReader.IsEmptyElement; + if (rowReader.NodeType == XmlNodeType.EndElement) { return newCols; } @@ -99,10 +106,16 @@ internal static HashSet LoadRowData(XmlReader rowReader, Dictionary previousNewCols = new HashSet(); + while (rowReader.Read() && rowReader.LocalName != rowElementName && rowReader.NodeType != XmlNodeType.EndElement) { bool isParentList = previousElement == rowReader.LocalName; @@ -125,6 +138,7 @@ internal static HashSet LoadRowData(XmlReader rowReader, Dictionary