如何读取XML和.NET 2.0
请访问:http://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/default.aspx如何读取XML和.NET 2.0
和下载SDALL.ZIP并解
然后你可以找到SDN.XML
我的问题是:
如何使用C#.net VS2005读取它?
将数据插入到Oracle数据库中?
回答:
//尝试从ZIP加载模式文件的DataSet //然后加载XML文件
DataSet dst = new DataSet(); dst.ReadXmlSchema("C:\\sdn.xsd");
dst.ReadXml("C:\\sdn.xml");
// Now you have list of tables that contain all information you need.
// For example punlishinformation
DataTable dtPubInfo = dst.Tables["publshInformation"];
string publishdateInfo = dtPubInfo.Rows[0]["Publish_Date"].ToString();
string recordCount = dtPubInfo.Rows[0]["Record_Count"].ToString();
DataTable dtsdnEtry = dst.Tables["sdnentry"];
// GEt all SDN entry
DataColumnCollection colColumns = dtsdnEtry.Columns;
foreach(DataRow dr in dtsdnEtry.Rows)
{
foreach(DataColumn dc in colColumns){
Console.WriteLine(dc.ColumnName + " - " + dr[dc.ColumnName].ToString());
}
Console.WriteLine("--------------------------------------------------");
}
回答:
xmldocument可以做到这一点! 更多:http://msdn.microsoft.com/library/system.xml.xmldocument.aspx
以上是 如何读取XML和.NET 2.0 的全部内容, 来源链接: utcz.com/qa/258232.html