在 c# 中使用 xsd 文件创建 xml 文件时出现问题
Posted
技术标签:
【中文标题】在 c# 中使用 xsd 文件创建 xml 文件时出现问题【英文标题】:Problems creating an xml file using an xsd file in c# 【发布时间】:2021-05-07 20:23:04 【问题描述】:我需要通过类从 XSD 文件创建 XML 文件。我是编程新手,所以我按照本教程制作了我的第一个测试 XML,结果很好:Generating XML file using XSD file
但现在我必须使用更大的 XSD,创建一个更大的 XML,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<test-xml xsi:noNamespaceSchemaLocation="test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Mod0>
<K0_1 KnZ="0.1">Input1</K0_1>
<K0_2 KnZ="0.2">Input2</K0_2>
<K0_3 KnZ="0.3">Input3</K0_3>
</Mod0>
<Mod1>
<K1_1 KnZ="1.1">Input1</K1_3>
<K1_2 KnZ="1.2">Input2</K1_4>
<K1_3 KnZ="1.3">Input3</K1_4>
</Mod1>
</test-xml>
我的问题是,本教程没有创建像这样的 XML 文件。
它只会使用<test-xml>
和<Mod0>
作为元素,没有<K0_1>
直到<K0_3>
,但我需要所有这些元素
它只会停在<Mod0>
,但我需要<Mod0>
到<Mod18>
最后,在我的示例代码中的输入之前,我没有得到KnZ="0.1"
等
我使用基于我的 XML 架构的 xsd.exe 工具创建了类,就像在第 1 步中的教程中一样,但现在我不知道如何编码,以便我的 XML 看起来像我在上面的示例代码中显示的那样。
谁能帮我解决这个问题?非常感谢。
提前致谢
【问题讨论】:
你有更大的 XSD 吗?给我们看看。 【参考方案1】:所呈现的 XML 结构非常值得怀疑。在 XML 元素名称中使用流水号并不是一个好主意。
最好如下修改:
Mod 元素正在使用属性进行编号,即<Mod id="0">
K 元素完全删除数字,即<K>
XML
<?xml version="1.0" encoding="UTF-8"?>
<test-xml xsi:noNamespaceSchemaLocation="test.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Mod id="0">
<K KnZ="0.1">Input1</K>
<K KnZ="0.2">Input2</K>
<K KnZ="0.3">Input3</K>
</Mod>
<Mod id="1">
<K KnZ="1.1">Input1</K>
<K KnZ="1.2">Input2</K>
<K KnZ="1.3">Input3</K>
</Mod>
</test-xml>
【讨论】:
您好,感谢您的回答。我完全同意您的看法,但遗憾的是,XML 结构的外观不是由我决定的。我必须保持我在示例中显示的方式。因此,我想知道您是否知道如何编写代码以获得上面显示的 XML 结构。我看过的视频和文档显示了与您所做的类似的事情,我也更喜欢这种方式,但遗憾的是,这对我来说不是一个选择。 没有 XSD 可用于动态 XML 元素名称。 好的,我明白了。所以用 C# 是不可能的,但它有可能以某种方式还是根本不可能?到目前为止唯一有效的是在 Visual Studio 中使用“XML Schema Explorer”,并且只使用“Generate Sample XML”函数。我完全按照我想要和需要的方式获得了 XML 文件,但我需要自动化这个过程,而我想这对于 XML Schema Explorer 是不可能的。特别是因为我无法输入我想要的输入。 与c#无关。考虑一下。您需要通过 XSD 定义 XML 结构和数据类型。元素和属性名称是不变的。只有元素和属性值可以是动态的 再次感谢。我有另一个问题,如果这听起来很愚蠢,我很抱歉,就像我说我是编程新手,可能不会立即理解某些东西。元素和属性名称(我查看了提供的 XSD。疯狂的事情。我以前所有的cmets都在目标上。 XSD 之所以如此之大,是因为它包含了名称中带有运行编号的类似元素。 ?
无论如何,我使用Free Online XSD to XML Converter 来生成基于XSD 的XML 文件。
XML
<?xml version="1.0" encoding="utf-8"?>
<xsozial-ba xsi:noNamespaceSchemaLocation="schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Mod0>
<M0_1 KnZ="27.92">99079</M0_1>
<M0_2 KnZ="2.55">72</M0_2>
<M0_3 KnZ="8.88">XSozial-BA-SGBII-Version-4.7.0</M0_3>
<M0_4 KnZ="42.7">B</M0_4>
<M0_5 KnZ="43.3">2?"i@+O** Q").9</M0_5>
<M0_6 KnZ="01.5">1993-12</M0_6>
<M0_7 KnZ="2.50">2</M0_7>
<M0_8 KnZ="6.4">1991-10-15T07:49:42.41</M0_8>
<M0_9 KnZ="5.7">string</M0_9>
<M0_10 KnZ="0.2">string</M0_10>
<M0_11 KnZ="96.31">string</M0_11>
</Mod0>
<Mod1>
<M1_3 KnZ="53.3">1997-02-04T20:06:35.92</M1_3>
<M1_4 KnZ="59.6">1996-01-03</M1_4>
<M1_5 KnZ="6.52">2006-04-10</M1_5>
<M1_6 KnZ="2.96">-1035960</M1_6>
<M1_8 KnZ="4.91">-323560</M1_8>
<M1_9 KnZ="64.0">-434850</M1_9>
<M1_10 KnZ="50.52">-946190</M1_10>
<M1_12 KnZ="57.58">-4517520</M1_12>
<M1_19 KnZ="69.52">3546560</M1_19>
<M1_32 KnZ="36.96">-2689910</M1_32>
<M1_34 KnZ="8.84">323430</M1_34>
<M1_35 KnZ="1.08">-4039730</M1_35>
<M1_36 KnZ="6.29">4143840</M1_36>
<M1_37 KnZ="4.3">53490</M1_37>
<M1_38 KnZ="4.43">-3294270</M1_38>
<M1_39 KnZ="35.6">-4457420</M1_39>
<M1_40 KnZ="94.2">3675630</M1_40>
<M1_41 KnZ="5.23">-1500170</M1_41>
<M1_42 KnZ="5.9">2701080</M1_42>
<M1_43 KnZ="8.59">1428750</M1_43>
<M1_44 KnZ="05.5">4831640</M1_44>
<M1_45 KnZ="01.75">-772490</M1_45>
<M1_46 KnZ="16.3">4249040</M1_46>
<M1_47 KnZ="80.47">-2078190</M1_47>
<M1_48 KnZ="7.4">1944800</M1_48>
<M1_49 KnZ="5.5">-2477650</M1_49>
<M1_50 KnZ="0.3">string</M1_50>
<M1_51 KnZ="2.7">string</M1_51>
</Mod1>
<Mod1>
<M1_3 KnZ="3.2">2003-04-10T15:04:00.32</M1_3>
<M1_4 KnZ="1.36">2009-02-27</M1_4>
<M1_5 KnZ="99.02">2003-11-27</M1_5>
<M1_6 KnZ="06.0">419950</M1_6>
<M1_8 KnZ="04.28">1755100</M1_8>
<M1_9 KnZ="8.2">189910</M1_9>
<M1_10 KnZ="66.7">-2927070</M1_10>
<M1_12 KnZ="87.06">-4779500</M1_12>
<M1_19 KnZ="58.70">2035670</M1_19>
<M1_32 KnZ="00.78">-2355280</M1_32>
<M1_34 KnZ="5.17">-781560</M1_34>
<M1_35 KnZ="1.9">-375510</M1_35>
<M1_36 KnZ="13.81">-1954930</M1_36>
<M1_37 KnZ="25.63">4396840</M1_37>
<M1_38 KnZ="48.2">-4610720</M1_38>
<M1_39 KnZ="3.9">2199970</M1_39>
<M1_40 KnZ="0.7">2007480</M1_40>
<M1_41 KnZ="92.2">-4517430</M1_41>
<M1_42 KnZ="01.12">1572730</M1_42>
<M1_43 KnZ="2.71">882600</M1_43>
<M1_44 KnZ="3.7">-4651460</M1_44>
<M1_45 KnZ="20.65">-2000710</M1_45>
<M1_46 KnZ="1.43">2650</M1_46>
<M1_47 KnZ="20.3">3447560</M1_47>
<M1_48 KnZ="9.0">-4908420</M1_48>
<M1_49 KnZ="5.29">-2389780</M1_49>
<M1_50 KnZ="7.5">string</M1_50>
<M1_51 KnZ="02.2">string</M1_51>
</Mod1>
<Mod1>
<M1_3 KnZ="4.39">1972-03-15T01:07:11.07</M1_3>
<M1_4 KnZ="7.9">2018-06-23</M1_4>
<M1_5 KnZ="79.9">1990-09-20</M1_5>
<M1_6 KnZ="2.5">3073880</M1_6>
<M1_8 KnZ="60.2">4130920</M1_8>
<M1_9 KnZ="1.9">336810</M1_9>
<M1_10 KnZ="69.94">4515090</M1_10>
<M1_12 KnZ="40.91">-4127340</M1_12>
<M1_19 KnZ="1.40">858060</M1_19>
<M1_32 KnZ="55.38">4615830</M1_32>
<M1_34 KnZ="73.56">210160</M1_34>
<M1_35 KnZ="9.08">-3908580</M1_35>
<M1_36 KnZ="9.9">-2980490</M1_36>
<M1_37 KnZ="8.3">2025480</M1_37>
<M1_38 KnZ="90.9">-2365230</M1_38>
<M1_39 KnZ="9.80">4466820</M1_39>
<M1_40 KnZ="5.37">519040</M1_40>
<M1_41 KnZ="37.92">872340</M1_41>
<M1_42 KnZ="02.82">2558650</M1_42>
<M1_43 KnZ="4.12">1821630</M1_43>
<M1_44 KnZ="23.7">2068090</M1_44>
<M1_45 KnZ="8.62">2416020</M1_45>
<M1_46 KnZ="57.25">-1816340</M1_46>
<M1_47 KnZ="93.79">-4509440</M1_47>
<M1_48 KnZ="6.50">4405600</M1_48>
<M1_49 KnZ="6.5">-235070</M1_49>
<M1_50 KnZ="0.72">string</M1_50>
<M1_51 KnZ="07.04">string</M1_51>
</Mod1>
<Mod1>
<M1_3 KnZ="0.23">1998-08-14T04:53:37.38</M1_3>
<M1_4 KnZ="8.98">2005-02-25</M1_4>
<M1_5 KnZ="79.19">2008-07-11</M1_5>
<M1_6 KnZ="4.55">-3704920</M1_6>
<M1_8 KnZ="73.8">-263030</M1_8>
<M1_9 KnZ="84.80">57590</M1_9>
<M1_10 KnZ="36.6">940690</M1_10>
<M1_12 KnZ="94.9">3917120</M1_12>
<M1_19 KnZ="51.6">-105510</M1_19>
<M1_32 KnZ="2.6">-4765710</M1_32>
<M1_34 KnZ="21.15">-3850180</M1_34>
<M1_35 KnZ="09.5">3601460</M1_35>
<M1_36 KnZ="4.3">520130</M1_36>
<M1_37 KnZ="14.6">-1178340</M1_37>
<M1_38 KnZ="38.72">-507960</M1_38>
<M1_39 KnZ="0.3">2918570</M1_39>
<M1_40 KnZ="4.1">1901600</M1_40>
<M1_41 KnZ="20.1">4635770</M1_41>
<M1_42 KnZ="9.7">1927940</M1_42>
<M1_43 KnZ="2.85">4947460</M1_43>
<M1_44 KnZ="4.10">1938930</M1_44>
<M1_45 KnZ="2.0">-4122950</M1_45>
<M1_46 KnZ="55.0">1571370</M1_46>
<M1_47 KnZ="2.2">1466590</M1_47>
<M1_48 KnZ="67.9">-2800</M1_48>
<M1_49 KnZ="7.60">-3522600</M1_49>
<M1_50 KnZ="6.7">string</M1_50>
<M1_51 KnZ="84.76">string</M1_51>
</Mod1>
<Mod1>
<M1_3 KnZ="6.15">2017-04-11T11:08:24.94</M1_3>
<M1_4 KnZ="48.7">1988-02-23</M1_4>
<M1_5 KnZ="29.0">2009-08-14</M1_5>
<M1_6 KnZ="5.54">-1765470</M1_6>
<M1_8 KnZ="31.2">2976520</M1_8>
<M1_9 KnZ="05.3">2047360</M1_9>
<M1_10 KnZ="0.3">703830</M1_10>
<M1_12 KnZ="4.6">4807270</M1_12>
<M1_19 KnZ="56.6">-1216620</M1_19>
<M1_32 KnZ="0.99">3731860</M1_32>
<M1_34 KnZ="18.92">-4935910</M1_34>
<M1_35 KnZ="1.26">4485410</M1_35>
<M1_36 KnZ="1.77">-3966440</M1_36>
<M1_37 KnZ="54.56">459660</M1_37>
<M1_38 KnZ="9.1">-1667630</M1_38>
<M1_39 KnZ="9.8">-592010</M1_39>
<M1_40 KnZ="1.2">2150560</M1_40>
<M1_41 KnZ="1.47">-3996040</M1_41>
<M1_42 KnZ="4.25">4332830</M1_42>
<M1_43 KnZ="01.00">4192800</M1_43>
<M1_44 KnZ="4.15">3229440</M1_44>
<M1_45 KnZ="4.6">223130</M1_45>
<M1_46 KnZ="20.5">-4835520</M1_46>
<M1_47 KnZ="0.9">785250</M1_47>
<M1_48 KnZ="8.3">4643610</M1_48>
<M1_49 KnZ="80.9">954990</M1_49>
<M1_50 KnZ="55.38">string</M1_50>
<M1_51 KnZ="72.8">string</M1_51>
</Mod1>
<Mod2>
<M2_1 KnZ="7.84">81788BG1441265</M2_1>
<M2_25 KnZ="48.7">string</M2_25>
<M2_3 KnZ="5.09">7</M2_3>
<M2_4 KnZ="4.3">2018-05-17T09:18:32.82</M2_4>
<M2_7 KnZ="0.49">1997-12-15</M2_7>
<M2_10 KnZ="17.8">2011-05-21</M2_10>
<M2_11 KnZ="79.0">78</M2_11>
<M2_12 KnZ="54.5">9</M2_12>
<M2_13 KnZ="59.3">6</M2_13>
<M2_14 KnZ="61.0">16</M2_14>
<M2_16 KnZ="01.23">532616.23</M2_16>
<M2_17 KnZ="0.3">696766.23</M2_17>
<M2_18 KnZ="10.73">789585.23</M2_18>
<M2_26 KnZ="70.8">2010-03-05</M2_26>
<M2_27 KnZ="09.3">2005</M2_27>
<M2_28 KnZ="1.49">743031.23</M2_28>
<M2_29 KnZ="3.18">172483.23</M2_29>
<M2_30 KnZ="7.59">684711.23</M2_30>
<M2_31 KnZ="3.16">string</M2_31>
<M2_32 KnZ="8.27">string</M2_32>
</Mod2>
<Mod2>
<M2_1 KnZ="40.33">02122BG6526060</M2_1>
<M2_25 KnZ="30.0">string</M2_25>
<M2_3 KnZ="44.4">4</M2_3>
<M2_4 KnZ="7.5">1987-01-19T04:21:54.89</M2_4>
<M2_7 KnZ="5.1">1994-10-08</M2_7>
<M2_10 KnZ="6.5">2017-02-24</M2_10>
<M2_11 KnZ="0.2">25</M2_11>
<M2_12 KnZ="36.80">28</M2_12>
<M2_13 KnZ="7.86">8</M2_13>
<M2_14 KnZ="7.53">6</M2_14>
<M2_16 KnZ="08.06">242118.23</M2_16>
<M2_17 KnZ="03.46">297682.23</M2_17>
<M2_18 KnZ="1.1">367004.23</M2_18>
<M2_26 KnZ="9.7">1993-06-21</M2_26>
<M2_27 KnZ="6.04">2005</M2_27>
<M2_28 KnZ="92.1">788827.23</M2_28>
<M2_29 KnZ="1.3">623526.23</M2_29>
<M2_30 KnZ="40.1">653595.23</M2_30>
<M2_31 KnZ="7.42">string</M2_31>
<M2_32 KnZ="3.8">string</M2_32>
</Mod2>
<Mod3>
<M3_1 KnZ="7.03">783c180142</M3_1>
<M3_2 KnZ="05.45">79029BG2201373</M3_2>
<M3_34 KnZ="99.0">string</M3_34>
<M3_3 KnZ="1.22">7</M3_3>
<M3_4 KnZ="6.7">1972-01-18T19:06:27.20</M3_4>
<M3_5 KnZ="8.1">string</M3_5>
<M3_6 KnZ="9.1">string</M3_6>
<M3_7 KnZ="6.2">string</M3_7>
<M3_8 KnZ="8.2">string</M3_8>
<M3_9 KnZ="3.2">string</M3_9>
<M3_10 KnZ="7.0">ABC</M3_10>
<M3_11 KnZ="6.75">string</M3_11>
<M3_12 KnZ="8.74">string</M3_12>
<M3_13 KnZ="0.6">54414</M3_13>
<M3_14 KnZ="25.8">string</M3_14>
<M3_18 KnZ="38.86">2003-10-26</M3_18>
<M3_19 KnZ="8.00">W</M3_19>
<M3_20 KnZ="8.3">_1Q0HUuNJ2b_</M3_20>
<M3_21 KnZ="45.32">036</M3_21>
<M3_22 KnZ="60.34">78</M3_22>
<M3_24 KnZ="4.0">5</M3_24>
<M3_26 KnZ="24.4">9</M3_26>
<M3_29 KnZ="0.4">false</M3_29>
<M3_35 KnZ="29.7">3</M3_35>
<M3_36 KnZ="2.7">1</M3_36>
<M3_37 KnZ="4.0">1</M3_37>
<M3_38 KnZ="33.17">65</M3_38>
<M3_39 KnZ="6.1">7</M3_39>
<M3_40 KnZ="82.8">7</M3_40>
<M3_41 KnZ="29.94">7</M3_41>
<M3_43 KnZ="47.87">3</M3_43>
<M3_45 KnZ="0.0">string</M3_45>
<M3_46 KnZ="36.55">string</M3_46>
</Mod3>
<Mod3>
<M3_1 KnZ="71.94">830q236679</M3_1>
<M3_2 KnZ="90.82">08861BG3180182</M3_2>
<M3_34 KnZ="50.51">string</M3_34>
<M3_3 KnZ="1.10">9</M3_3>
<M3_4 KnZ="0.19">2016-04-26T12:37:35.14</M3_4>
<M3_5 KnZ="07.8">string</M3_5>
<M3_6 KnZ="80.7">string</M3_6>
<M3_7 KnZ="90.4">string</M3_7>
<M3_8 KnZ="2.01">string</M3_8>
<M3_9 KnZ="0.00">string</M3_9>
<M3_10 KnZ="5.31"></M3_10>
<M3_11 KnZ="45.95">string</M3_11>
<M3_12 KnZ="39.10">string</M3_12>
<M3_13 KnZ="36.84">13520</M3_13>
<M3_14 KnZ="4.96">string</M3_14>
<M3_18 KnZ="18.0">2019-11-22</M3_18>
<M3_19 KnZ="5.1">,</M3_19>
<M3_20 KnZ="7.49">G____Y2OVrOP</M3_20>
<M3_21 KnZ="8.33">527</M3_21>
<M3_22 KnZ="9.07">29</M3_22>
<M3_24 KnZ="52.0">3</M3_24>
<M3_26 KnZ="4.5">6</M3_26>
<M3_29 KnZ="8.4">false</M3_29>
<M3_35 KnZ="6.19">46</M3_35>
<M3_36 KnZ="54.40">1</M3_36>
<M3_37 KnZ="56.3">true</M3_37>
<M3_38 KnZ="9.39">32</M3_38>
<M3_39 KnZ="6.88">6</M3_39>
<M3_40 KnZ="44.2">5</M3_40>
<M3_41 KnZ="6.28">1</M3_41>
<M3_43 KnZ="00.23">4</M3_43>
<M3_45 KnZ="2.29">string</M3_45>
<M3_46 KnZ="7.1">string</M3_46>
</Mod3>
<Mod3>
<M3_1 KnZ="50.48">249k697353</M3_1>
<M3_2 KnZ="1.8">78065BG0911821</M3_2>
<M3_34 KnZ="9.43">string</M3_34>
<M3_3 KnZ="1.8">1</M3_3>
<M3_4 KnZ="15.83">1986-12-16T03:32:36.64</M3_4>
<M3_5 KnZ="5.0">string</M3_5>
<M3_6 KnZ="4.7">string</M3_6>
<M3_7 KnZ="0.4">string</M3_7>
<M3_8 KnZ="9.22">string</M3_8>
<M3_9 KnZ="81.3">string</M3_9>
<M3_10 KnZ="50.84"></M3_10>
<M3_11 KnZ="15.7">string</M3_11>
<M3_12 KnZ="68.5">string</M3_12>
<M3_13 KnZ="4.99">47940</M3_13>
<M3_14 KnZ="84.53">string</M3_14>
<M3_18 KnZ="9.18">2010-09-07</M3_18>
<M3_19 KnZ="0.60">,</M3_19>
<M3_20 KnZ="29.45">gSk7_58F6bQD</M3_20>
<M3_21 KnZ="7.3">986</M3_21>
<M3_22 KnZ="6.7">4</M3_22>
<M3_24 KnZ="9.7">2</M3_24>
<M3_26 KnZ="26.81">2</M3_26>
<M3_29 KnZ="57.94">1</M3_29>
<M3_35 KnZ="61.60">359</M3_35>
<M3_36 KnZ="07.6">false</M3_36>
<M3_37 KnZ="39.10">1</M3_37>
<M3_38 KnZ="6.22">68</M3_38>
<M3_39 KnZ="2.82">4</M3_39>
<M3_40 KnZ="2.48">6</M3_40>
<M3_41 KnZ="4.12">1</M3_41>
<M3_43 KnZ="52.1">1</M3_43>
<M3_45 KnZ="68.46">string</M3_45>
<M3_46 KnZ="19.9">string</M3_46>
</Mod3>
<Mod3>
<M3_1 KnZ="41.35">758q315020</M3_1>
<M3_2 KnZ="45.79">28099BG4695630</M3_2>
<M3_34 KnZ="70.04">string</M3_34>
<M3_3 KnZ="3.84">8</M3_3>
<M3_4 KnZ="53.28">1982-01-13T05:36:48.27</M3_4>
<M3_5 KnZ="4.5">string</M3_5>
<M3_6 KnZ="15.2">string</M3_6>
<M3_7 KnZ="12.0">string</M3_7>
<M3_8 KnZ="80.32">string</M3_8>
<M3_9 KnZ="9.5">string</M3_9>
<M3_10 KnZ="9.5"></M3_10>
<M3_11 KnZ="81.7">string</M3_11>
<M3_12 KnZ="07.9">string</M3_12>
<M3_13 KnZ="44.65">30629</M3_13>
<M3_14 KnZ="80.44">string</M3_14>
<M3_18 KnZ="73.78">2008-10-08</M3_18>
<M3_19 KnZ="5.7">,</M3_19>
<M3_20 KnZ="0.1">0hi7_245QYN_</M3_20>
<M3_21 KnZ="69.57">441</M3_21>
<M3_22 KnZ="78.4">29</M3_22>
<M3_24 KnZ="84.7">7</M3_24>
<M3_26 KnZ="95.7">1</M3_26>
<M3_29 KnZ="77.2">1</M3_29>
<M3_35 KnZ="32.08">99</M3_35>
<M3_36 KnZ="2.0">false</M3_36>
<M3_37 KnZ="4.1">1</M3_37>
<M3_38 KnZ="35.10">39</M3_38>
<M3_39 KnZ="88.00"></M3_39>
<M3_40 KnZ="86.32">1</M3_40>
<M3_41 KnZ="3.9">3</M3_41>
<M3_43 KnZ="46.0">8</M3_43>
<M3_45 KnZ="8.0">string</M3_45>
<M3_46 KnZ="0.0">string</M3_46>
</Mod3>
<Mod3>
<M3_1 KnZ="86.2">2234138078</M3_1>
<M3_2 KnZ="7.0">46048BG6406738</M3_2>
<M3_34 KnZ="9.7">string</M3_34>
<M3_3 KnZ="56.6">9</M3_3>
<M3_4 KnZ="71.47">1994-07-12T21:35:55.77</M3_4>
<M3_5 KnZ="92.33">string</M3_5>
<M3_6 KnZ="8.4">string</M3_6>
<M3_7 KnZ="3.40">string</M3_7>
<M3_8 KnZ="46.0">string</M3_8>
<M3_9 KnZ="0.8">string</M3_9>
<M3_10 KnZ="4.26">ABC</M3_10>
<M3_11 KnZ="82.07">string</M3_11>
<M3_12 KnZ="27.15">string</M3_12>
<M3_13 KnZ="55.42">73388</M3_13>
<M3_14 KnZ="62.55">string</M3_14>
<M3_18 KnZ="5.3">1992-01-03</M3_18>
<M3_19 KnZ="9.5">W</M3_19>
<M3_20 KnZ="5.2">hv_1Zv_cR7_2</M3_20>
<M3_21 KnZ="89.05">132</M3_21>
<M3_22 KnZ="5.34">4</M3_22>
<M3_24 KnZ="45.4">4</M3_24>
<M3_26 KnZ="7.4">9</M3_26>
<M3_29 KnZ="90.05">false</M3_29>
<M3_35 KnZ="05.4">03</M3_35>
<M3_36 KnZ="18.89">true</M3_36>
<M3_37 KnZ="77.28">1</M3_37>
<M3_38 KnZ="38.6">77</M3_38>
<M3_39 KnZ="09.71">7</M3_39>
<M3_40 KnZ="7.5">1</M3_40>
<M3_41 KnZ="5.9">9</M3_41>
<M3_43 KnZ="25.54">5</M3_43>
<M3_45 KnZ="81.3">string</M3_45>
<M3_46 KnZ="6.2">string</M3_46>
</Mod3>
<Mod4>
<M4_1 KnZ="04.67">516C002312</M4_1>
<M4_2 KnZ="8.27">85358BG1042986</M4_2>
<M4_9 KnZ="9.7">string</M4_9>
<M4_3 KnZ="69.1">6</M4_3>
<M4_4 KnZ="49.60">1998-06-12T06:22:53.10</M4_4>
<M4_5 KnZ="2.4">438</M4_5>
<M4_6 KnZ="81.8">226308.23</M4_6>
<M4_7 KnZ="35.45">1991-06-01</M4_7>
<M4_8 KnZ="41.8">1988-09-26</M4_8>
<M4_10 KnZ="1.66">string</M4_10>
<M4_11 KnZ="8.93">string</M4_11>
</Mod4>
<Mod4>
<M4_1 KnZ="26.82">852_861079</M4_1>
<M4_2 KnZ="3.3">87906BG5376272</M4_2>
<M4_9 KnZ="68.16">string</M4_9>
<M4_3 KnZ="9.84">7</M4_3>
<M4_4 KnZ="57.4">1990-06-15T18:02:23.88</M4_4>
<M4_5 KnZ="4.6">762</M4_5>
<M4_6 KnZ="7.74">48054.23</M4_6>
<M4_7 KnZ="44.93">1988-10-05</M4_7>
<M4_8 KnZ="6.92">2017-05-23</M4_8>
<M4_10 KnZ="9.21">string</M4_10>
<M4_11 KnZ="2.04">string</M4_11>
</Mod4>
<Mod4>
<M4_1 KnZ="44.1">560_573498</M4_1>
<M4_2 KnZ="5.6">06723BG8509320</M4_2>
<M4_9 KnZ="1.6">string</M4_9>
<M4_3 KnZ="9.36">3</M4_3>
<M4_4 KnZ="7.59">1985-02-07T14:30:32.30</M4_4>
<M4_5 KnZ="0.06">608</M4_5>
<M4_6 KnZ="70.0">163284.23</M4_6>
<M4_7 KnZ="64.2">2012-02-03</M4_7>
<M4_8 KnZ="63.4">1989-03-06</M4_8>
<M4_10 KnZ="4.1">string</M4_10>
<M4_11 KnZ="3.23">string</M4_11>
</Mod4>
<Mod4>
<M4_1 KnZ="30.8">953_608374</M4_1>
<M4_2 KnZ="0.94">02902BG8790208</M4_2>
<M4_9 KnZ="7.52">string</M4_9>
<M4_3 KnZ="83.74">2</M4_3>
<M4_4 KnZ="47.87">1977-10-06T12:02:47.54</M4_4>
<M4_5 KnZ="5.3">667</M4_5>
<M4_6 KnZ="6.99">893683.23</M4_6>
<M4_7 KnZ="34.41">2016-08-28</M4_7>
<M4_8 KnZ="43.47">1983-03-15</M4_8>
<M4_10 KnZ="8.7">string</M4_10>
<M4_11 KnZ="17.4">string</M4_11>
</Mod4>
<Mod5>
<M5_1 KnZ="82.9">8398640296</M5_1>
<M5_2 KnZ="64.2">98431BG8790232</M5_2>
<M5_9 KnZ="2.1">string</M5_9>
<M5_3 KnZ="0.0">6</M5_3>
<M5_4 KnZ="62.4">2019-03-22T15:17:14.43</M5_4>
<M5_5 KnZ="20.04">145</M5_5>
<M5_6 KnZ="6.93">70433.23</M5_6>
<M5_10 KnZ="36.4">58</M5_10>
<M5_11 KnZ="40.8">126736.23</M5_11>
<M5_13 KnZ="33.30">string</M5_13>
<M5_14 KnZ="5.73">string</M5_14>
</Mod5>
<Mod7>
<M7_1 KnZ="82.1">423_519620</M7_1>
<M7_2 KnZ="03.0">48032BG3955047</M7_2>
<M7_12 KnZ="5.2">string</M7_12>
<M7_3 KnZ="21.14">8</M7_3>
<M7_4 KnZ="84.42">2002-09-12T07:42:56.87</M7_4>
<M7_6 KnZ="56.4">565598.23</M7_6>
<M7_8 KnZ="9.03">10</M7_8>
<M7_9 KnZ="4.1">988534.23</M7_9>
<M7_10 KnZ="1.2">766323.23</M7_10>
<M7_14 KnZ="0.4">268945.23</M7_14>
<M7_15 KnZ="4.7">36217.23</M7_15>
<M7_16 KnZ="71.22">string</M7_16>
<M7_17 KnZ="63.8">string</M7_17>
</Mod7>
<Mod8>
<M8_1 KnZ="77.31">915B189370</M8_1>
<M8_2 KnZ="2.9">11439BG3859455</M8_2>
<M8_10 KnZ="66.17">string</M8_10>
<M8_3 KnZ="5.0">4</M8_3>
<M8_4 KnZ="63.5">1996-03-28T14:55:21.87</M8_4>
<M8_6 KnZ="9.02">318</M8_6>
<M8_7 KnZ="5.12">955557.23</M8_7>
<M8_8 KnZ="57.4">2018-03-05</M8_8>
<M8_9 KnZ="89.8">1977-04-08</M8_9>
<M8_11 KnZ="48.5">string</M8_11>
<M8_12 KnZ="7.33">string</M8_12>
<M8_13 KnZ="52.4">string</M8_13>
</Mod8>
<Mod10>
<M10_1 KnZ="78.54">820m873680</M10_1>
<M10_20 KnZ="5.27">string</M10_20>
<M10_4 KnZ="00.84">1998-01-21T15:54:38.32</M10_4>
<M10_5 KnZ="83.6">5</M10_5>
<M10_6 KnZ="86.0">2005-10-09</M10_6>
<M10_7 KnZ="7.9">2002-06-03</M10_7>
<M10_8 KnZ="47.19">15</M10_8>
<M10_9 KnZ="30.45">97</M10_9>
<M10_10 KnZ="2.1">1974</M10_10>
<M10_13 KnZ="77.65">false</M10_13>
<M10_16 KnZ="69.44">1987-06-19</M10_16>
<M10_21 KnZ="2.6">8</M10_21>
<M10_23 KnZ="0.31">7</M10_23>
<M10_28 KnZ="36.20">40158938</M10_28>
<M10_29 KnZ="3.2">95338014</M10_29>
<M10_30 KnZ="2.0">1993-03-20T00:55:27.15</M10_30>
<M10_31 KnZ="67.5">2</M10_31>
<M10_32 KnZ="0.13">true</M10_32>
<M10_33 KnZ="7.06">7</M10_33>
<M10_34 KnZ="10.34">string</M10_34>
<M10_35 KnZ="10.35">string</M10_35>
</Mod10>
<Mod11>
<M11_1 KnZ="80.33">074l382106</M11_1>
<M11_11 KnZ="8.2">string</M11_11>
<M11_4 KnZ="3.21">2005-01-22T01:35:47.34</M11_4>
<M11_5 KnZ="05.4">1998-11-08</M11_5>
<M11_6 KnZ="9.55">2011-10-28</M11_6>
<M11_7 KnZ="2.14">5</M11_7>
<M11_10 KnZ="64.93">54</M11_10>
<M11_14 KnZ="14.42">87447767</M11_14>
<M11_15 KnZ="52.15">17</M11_15>
<M11_16 KnZ="11.56">1996-06-03T03:46:31.43</M11_16>
<M11_17 KnZ="52.0">false</M11_17>
<M11_18 KnZ="43.66">string</M11_18>
<M11_19 KnZ="1.4">string</M11_19>
</Mod11>
<Mod12>
<M12_1 KnZ="59.48">711H885079</M12_1>
<M12_15 KnZ="20.78">string</M12_15>
<M12_4 KnZ="74.21">1982-09-23T12:16:04.42</M12_4>
<M12_5 KnZ="9.6">1</M12_5>
<M12_10 KnZ="45.25">0</M12_10>
<M12_16 KnZ="3.1">2</M12_16>
<M12_17 KnZ="6.8">5</M12_17>
<M12_18 KnZ="9.7">true</M12_18>
<M12_19 KnZ="0.3">string</M12_19>
<M12_20 KnZ="97.5">string</M12_20>
</Mod12>
<Mod13>
<M13_1 KnZ="0.75">738D383042</M13_1>
<M13_33 KnZ="6.6">string</M13_33>
<M13_4 KnZ="66.29">2006-11-24T12:58:05.00</M13_4>
<M13_5 KnZ="2.79">1990-01-28</M13_5>
<M13_7 KnZ="1.6">1981-02-13</M13_7>
<M13_8 KnZ="3.76">2067</M13_8>
<M13_10 KnZ="36.9">50</M13_10>
<M13_12 KnZ="5.6">09845139</M13_12>
<M13_13 KnZ="47.61">421479.23</M13_13>
<M13_16 KnZ="61.4">5</M13_16>
<M13_35 KnZ="86.95">string</M13_35>
<M13_36 KnZ="1.0">28</M13_36>
<M13_37 KnZ="12.4">1998-07-21T04:31:32.86</M13_37>
<M13_38 KnZ="6.8">79296731</M13_38>
<M13_39 KnZ="80.56">7</M13_39>
<M13_40 KnZ="63.8">string</M13_40>
<M13_41 KnZ="48.7">string</M13_41>
</Mod13>
<Mod14>
<M14_1 KnZ="6.4">944c687231</M14_1>
<M14_18 KnZ="88.8">string</M14_18>
<M14_4 KnZ="71.28">1994-07-11T02:46:34.93</M14_4>
<M14_7 KnZ="34.1">57</M14_7>
<M14_14 KnZ="4.1">1980-07-27</M14_14>
<M14_15 KnZ="03.8">1972-02-06</M14_15>
<M14_16 KnZ="9.9">2008-04-02</M14_16>
<M14_17 KnZ="1.7">1988-05-03</M14_17>
<M14_19 KnZ="76.5">string</M14_19>
<M14_20 KnZ="8.56">string</M14_20>
</Mod14>
<Mod15>
<M15_1 KnZ="5.24">2016-03-10T11:18:31.47</M15_1>
<M15_4 KnZ="2.1">1330</M15_4>
<M15_5 KnZ="74.7">4850</M15_5>
<M15_6 KnZ="52.74">94</M15_6>
<M15_7 KnZ="9.5">4124</M15_7>
<M15_8 KnZ="14.2">string</M15_8>
<M15_9 KnZ="00.11">1981-08-07</M15_9>
<M15_10 KnZ="79.0">1982-09-11</M15_10>
<M15_11 KnZ="51.7">52</M15_11>
<M15_15 KnZ="53.41">99914</M15_15>
<M15_16 KnZ="56.31">string</M15_16>
<M15_17 KnZ="54.72">string</M15_17>
<M15_18 KnZ="91.12">69730972</M15_18>
<M15_19 KnZ="81.7">string</M15_19>
<M15_20 KnZ="7.6"></M15_20>
<M15_21 KnZ="59.27">79995</M15_21>
<M15_22 KnZ="16.93">string</M15_22>
<M15_23 KnZ="82.7">7</M15_23>
<M15_24 KnZ="6.9">659</M15_24>
<M15_26 KnZ="37.4">11</M15_26>
<M15_27 KnZ="2.2">719</M15_27>
<M15_28 KnZ="76.59">810</M15_28>
<M15_29 KnZ="2.01">9179</M15_29>
<M15_30 KnZ="2.57">5401</M15_30>
<M15_31 KnZ="98.92">1981-04-21T16:37:08.82</M15_31>
<M15_32 KnZ="7.93">32376237</M15_32>
<M15_33 KnZ="9.97">string</M15_33>
<M15_34 KnZ="8.95">string</M15_34>
</Mod15>
<Mod16>
<M16_1 KnZ="8.95">2013-05-26T09:03:34.03</M16_1>
<M16_2 KnZ="3.4">1</M16_2>
<M16_3 KnZ="9.73">8</M16_3>
<M16_4 KnZ="94.79">72</M16_4>
<M16_5 KnZ="9.60">83</M16_5>
<M16_6 KnZ="20.6">7</M16_6>
<M16_7 KnZ="93.24">21</M16_7>
<M16_8 KnZ="8.5">6601</M16_8>
<M16_9 KnZ="42.01">string</M16_9>
<M16_10 KnZ="29.37">string</M16_10>
</Mod16>
<Mod16>
<M16_1 KnZ="7.5">2008-05-06T13:35:51.13</M16_1>
<M16_2 KnZ="5.2">7</M16_2>
<M16_3 KnZ="6.8">4</M16_3>
<M16_4 KnZ="9.0">8</M16_4>
<M16_5 KnZ="0.1">7</M16_5>
<M16_6 KnZ="36.9">46</M16_6>
<M16_7 KnZ="5.9">11</M16_7>
<M16_8 KnZ="1.05">9791</M16_8>
<M16_9 KnZ="94.20">string</M16_9>
<M16_10 KnZ="71.3">string</M16_10>
</Mod16>
<Mod16>
<M16_1 KnZ="8.51">2003-12-09T12:00:57.08</M16_1>
<M16_2 KnZ="92.41">7</M16_2>
<M16_3 KnZ="23.6">2</M16_3>
<M16_4 KnZ="90.1">58</M16_4>
<M16_5 KnZ="1.0">1</M16_5>
<M16_6 KnZ="73.5">76</M16_6>
<M16_7 KnZ="7.02">4</M16_7>
<M16_8 KnZ="43.21">1857</M16_8>
<M16_9 KnZ="44.49">string</M16_9>
<M16_10 KnZ="00.3">string</M16_10>
</Mod16>
<Mod17>
<M17_1 KnZ="91.5">7051582778</M17_1>
<M17_3 KnZ="06.94">string</M17_3>
<M17_4 KnZ="88.5">1973-05-14T10:32:08.69</M17_4>
<M17_5 KnZ="38.74">string</M17_5>
<M17_6 KnZ="0.67">1993-06-11</M17_6>
<M17_7 KnZ="19.0">2015-09-15</M17_7>
<M17_8 KnZ="4.15">string</M17_8>
<M17_9 KnZ="15.3">string</M17_9>
</Mod17>
<Mod17>
<M17_1 KnZ="7.1">7331127501</M17_1>
<M17_3 KnZ="09.7">string</M17_3>
<M17_4 KnZ="0.51">1977-03-16T06:14:25.52</M17_4>
<M17_5 KnZ="6.0">string</M17_5>
<M17_6 KnZ="6.94">1988-11-13</M17_6>
<M17_7 KnZ="49.9">1973-11-08</M17_7>
<M17_8 KnZ="15.92">string</M17_8>
<M17_9 KnZ="31.32">string</M17_9>
</Mod17>
<Mod17>
<M17_1 KnZ="1.27">0889227931</M17_1>
<M17_3 KnZ="1.3">string</M17_3>
<M17_4 KnZ="83.9">2007-04-25T10:50:57.58</M17_4>
<M17_5 KnZ="44.7">string</M17_5>
<M17_6 KnZ="77.8">2003-12-17</M17_6>
<M17_7 KnZ="95.4">2003-09-10</M17_7>
<M17_8 KnZ="0.5">string</M17_8>
<M17_9 KnZ="10.99">string</M17_9>
</Mod17>
<Mod17>
<M17_1 KnZ="4.4">785I231751</M17_1>
<M17_3 KnZ="60.59">string</M17_3>
<M17_4 KnZ="75.36">1986-04-21T06:35:41.99</M17_4>
<M17_5 KnZ="6.9">string</M17_5>
<M17_6 KnZ="2.9">1971-04-23</M17_6>
<M17_7 KnZ="68.1">1970-10-16</M17_7>
<M17_8 KnZ="8.70">string</M17_8>
<M17_9 KnZ="2.9">string</M17_9>
</Mod17>
<Mod17>
<M17_1 KnZ="40.88">361x328583</M17_1>
<M17_3 KnZ="37.1">string</M17_3>
<M17_4 KnZ="7.26">2015-02-15T18:24:22.56</M17_4>
<M17_5 KnZ="0.4">string</M17_5>
<M17_6 KnZ="0.27">2010-05-18</M17_6>
<M17_7 KnZ="3.13">1977-08-26</M17_7>
<M17_8 KnZ="6.8">string</M17_8>
<M17_9 KnZ="0.9">string</M17_9>
</Mod17>
<Mod18>
<M18_1 KnZ="7.60">891_193121</M18_1>
<M18_2 KnZ="8.81">48213BG9962640</M18_2>
<M18_3 KnZ="1.29">string</M18_3>
<M18_4 KnZ="1.84">1981-11-10T04:34:42.14</M18_4>
<M18_6 KnZ="2.3">574003.23</M18_6>
<M18_7 KnZ="1.69">716121.23</M18_7>
<M18_8 KnZ="2.9">244879.23</M18_8>
<M18_9 KnZ="7.7">995622.22</M18_9>
<M18_10 KnZ="10.76">480830.23</M18_10>
<M18_11 KnZ="29.96">537223.23</M18_11>
<M18_12 KnZ="8.9">315441.23</M18_12>
<M18_13 KnZ="58.63">830201.23</M18_13>
<M18_14 KnZ="11.3">784861.23</M18_14>
<M18_15 KnZ="8.1">617589.23</M18_15>
<M18_16 KnZ="5.15">655490.23</M18_16>
<M18_17 KnZ="22.2">397393.23</M18_17>
<M18_18 KnZ="6.9">299696.23</M18_18>
<M18_19 KnZ="62.93">584218.23</M18_19>
<M18_20 KnZ="75.3">string</M18_20>
<M18_21 KnZ="2.72">string</M18_21>
</Mod18>
<Mod18>
<M18_1 KnZ="7.6">0968249753</M18_1>
<M18_2 KnZ="10.9">40187BG7209368</M18_2>
<M18_3 KnZ="49.54">string</M18_3>
<M18_4 KnZ="9.3">1999-05-09T06:59:51.96</M18_4>
<M18_6 KnZ="92.02">163860.23</M18_6>
<M18_7 KnZ="22.78">394314.23</M18_7>
<M18_8 KnZ="4.5">33738.23</M18_8>
<M18_9 KnZ="20.65">849665.23</M18_9>
<M18_10 KnZ="6.4">260719.23</M18_10>
<M18_11 KnZ="24.29">845075.23</M18_11>
<M18_12 KnZ="7.2">976291.23</M18_12>
<M18_13 KnZ="29.5">109199.23</M18_13>
<M18_14 KnZ="70.93">359511.23</M18_14>
<M18_15 KnZ="08.22">36771.23</M18_15>
<M18_16 KnZ="94.05">357102.23</M18_16>
<M18_17 KnZ="06.7">721879.23</M18_17>
<M18_18 KnZ="37.4">704059.23</M18_18>
<M18_19 KnZ="13.34">650454.23</M18_19>
<M18_20 KnZ="2.3">string</M18_20>
<M18_21 KnZ="1.9">string</M18_21>
</Mod18>
</xsozial-ba>
【讨论】:
以上是关于在 c# 中使用 xsd 文件创建 xml 文件时出现问题的主要内容,如果未能解决你的问题,请参考以下文章