0

I am trying to serialize an XML with C#, which has XMLElement and XMLArray. When Serialized am getting XML as

<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>

In Result, I want to see ProductVersion Node before TestCaseResults Node,

So, XML looks like

<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>

I have already tried putting ProductVersions before TestCaseResults in C# property declrations and XML Element Order, but it is not working .

Thanks in Advance

Mohit
  • 65
  • 7
  • possible duplicate of http://stackoverflow.com/questions/6455067/xml-serialization-question-order-of-elementsc – bkdev Feb 10 '16 at 11:49
  • I can't use XMLArray as XMLElement since I am attaching an XSLT to it, which is iterating and converting to HTML – Mohit Feb 10 '16 at 12:00

0 Answers0