我有一个XML文件,如下所示。
<?xml version="1.0" encoding="utf-8" ?>
<SPs>
<SP>
<seq>A01</seq>
<id>001</id>
<sp_desc>Stored Procedure 001</sp_desc>
<sp_name>getCategory</sp_name>
<para1_name>CategoryID</para1_name>
<para2_name>CategoryName</para2_name>
<para3_name></para3_name>
<para4_name></para4_name>
<para5_name></para5_name>
<para1_value>1</para1_value>
<para2_value>Hardware Solutions</para2_value>
<para3_value></para3_value>
<para4_value></para4_value>
<para5_value></para5_value>
<outputas>myreport-{DateTime}.xlsx</outputas>
<status>1</status>
</SP>
</SPs>
我可以通过DataSet的ReadXML方法加载它,没问题。
当我使用下面的代码时,我的列数为16:
myDS.Tables[0].AsEnumerable().CopyToDataTable().Columns.Count
当我得到XML以下时,它似乎无法识别4个参数字段,现在它返回的列数为14。
<?xml version="1.0" encoding="utf-8" ?>
<SPs>
<SP>
<seq>A01</seq>
<id>001</id>
<sp_desc>Stored Procedure 001</sp_desc>
<sp_name>getCategory</sp_name>
<para1_name type="string">CategoryID</para1_name>
<para2_name type="string">CategoryName</para2_name>
<para3_name type="string"></para3_name>
<para4_name type="string"></para4_name>
<para5_name type="string"></para5_name>
<para1_value>1</para1_value>
<para2_value>Hardware Solutions</para2_value>
<para3_value></para3_value>
<para4_value></para4_value>
<para5_value></para5_value>
<outputas>myreport-{DateTime}.xlsx</outputas>
<status>1</status>
</SP>
</SPs>
我们可以做些什么让它返回16?
最终我想访问:
myDS.Tables[0].AsEnumerable().CopyToDataTable().Columns