jhlim 20240202_2

This commit is contained in:
t001310
2025-02-28 15:00:32 +09:00
parent 8fddc5bca4
commit a4169bb683
11 changed files with 1068 additions and 38 deletions

View File

@@ -0,0 +1,55 @@
using System;
using System.Data;
using System.IO;
using System.Xml;
namespace DDUtilityApp.MESDOWNLOADER
{
public static class XmlToDsConverter
{
public static DataSet ConvertXmlToDataSet(string xmlFilePath)
{
try
{
DataSet dataSet = new DataSet();
using (StreamReader reader = new StreamReader(xmlFilePath, System.Text.Encoding.UTF8))
{
dataSet.ReadXml(reader);
}
return dataSet;
}
catch (Exception ex)
{
Console.WriteLine($"XML 변환 오류: {ex.Message}");
return null;
}
}
public static void PrintDataSet(DataSet dataSet)
{
if (dataSet == null)
{
Console.WriteLine("데이터셋이 비어 있습니다.");
return;
}
foreach (DataTable table in dataSet.Tables)
{
Console.WriteLine($"테이블: {table.TableName}");
foreach (DataRow row in table.Rows)
{
foreach (DataColumn column in table.Columns)
{
Console.WriteLine($"{column.ColumnName}: {row[column]}");
}
}
}
}
}
}
// 사용 예제
// string xmlPath = "ViewList.xml";
// DataSet ds = XmlToDataSetConverter.ConvertXmlToDataSet(xmlPath);
// XmlToDataSetConverter.PrintDataSet(ds);