我正在尝试使用C#序列化XML,它具有XMLElement和XMLArray。 当Serialized我正在获取XML
时<TestPlanResult xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" TestPlanRunStartedDateTime="02/10/2016 2:53 AM" TestPlanName="DataReconciliation" TestPlanRunTime="00:00:44.8979705"TestCaseCount="2" PassingTestCaseCount="2" FailingTestCaseCount="0" RemediationTestCount="0" Pass="true" ValidationPointCount="3">
<TestCaseResults Pass="true" Parameters="" RemediationToFollow="false" TestCaseName="0.1.5.2 InstallationMaintenance.GetInstallationFiles" RunTime="00:00:20.7972729" ValidationPointCount="2">
</TestCaseResults>
<TestCaseResults Pass="true" Parameters="" RemediationToFollow="false" TestCaseName="CheckForFullCompletion" RunTime="" ValidationPointCount="1">
</TestCaseResults>
<ProductVersions DbVersion="" AIEVersion="8001" ConsoleVersion="8001" MediatorVersion="9000" MonitorVersion="8001" DataIndexerVersion="1504" JobManagerVersion="" ARMVersion="8001"/>
</TestPlanResult>
在结果中,我想在TestCaseResults节点之前看到ProductVersion节点,
所以,XML看起来像
<TestPlanResult xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" TestPlanRunStartedDateTime="02/10/2016 2:53 AM" TestPlanName="DataReconciliation" TestPlanRunTime="00:00:44.8979705"TestCaseCount="2" PassingTestCaseCount="2" FailingTestCaseCount="0" RemediationTestCount="0" Pass="true" ValidationPointCount="3">
<ProductVersions DbVersion="" AIEVersion="8001" ConsoleVersion="8001" MediatorVersion="9000" MonitorVersion="8001" DataIndexerVersion="1504" JobManagerVersion="" ARMVersion="8001"/>
<TestCaseResults Pass="true" Parameters="" RemediationToFollow="false" TestCaseName="0.1.5.2 InstallationMaintenance.GetInstallationFiles" RunTime="00:00:20.7972729" ValidationPointCount="2">
</TestCaseResults>
<TestCaseResults Pass="true" Parameters="" RemediationToFollow="false" TestCaseName="CheckForFullCompletion" RunTime="" ValidationPointCount="1">
</TestCaseResults>
</TestPlanResult>
我已经尝试将TestVaseResults中的ProductVersions放在C#属性declrations和XML Element Order中,但是它没有用。
先谢谢