code_junkie

How can I get this XML Structure

Nov 13th, 2011
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. public class MyInput
  2. {
  3. [System.Xml.Serialization.XmlArrayItem("Demographic")]
  4. public DemographicsInfo[] Demographics {get; set;}
  5. }
  6.  
  7. public class DemographicsInfo
  8. {
  9. [System.Xml.Serialization.XmlAttributeAttribute()]
  10. public string Name { get; set; }
  11. public string Value { get; set; }
  12. }
  13.  
  14. <Demographics>
  15. <Demographic Name="String">
  16. <value>string</value>
  17. </Demographic>
  18. <Demographic Name="String">
  19. <value>string</value>
  20. </Demographic>
  21. </Demographics>
  22.  
  23. <Demographics>
  24. <Demographic Name="String">string</Demographic>
  25. <Demographic Name="String">string</Demographic>
  26. </Demographics>
  27.  
  28. xsd foo.xml
  29. xsd foo.xsd /classes
  30.  
  31. //------------------------------------------------------------------------------
  32. // <auto-generated>
  33. // This code was generated by a tool.
  34. // Runtime Version:2.0.50727.3053
  35. //
  36. // Changes to this file may cause incorrect behavior and will be lost if
  37. // the code is regenerated.
  38. // </auto-generated>
  39. //------------------------------------------------------------------------------
  40.  
  41. using System.Xml.Serialization;
  42.  
  43. //
  44. // This source code was auto-generated by xsd, Version=2.0.50727.3038.
  45. //
  46.  
  47.  
  48. /// <remarks/>
  49. [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
  50. [System.SerializableAttribute()]
  51. [System.Diagnostics.DebuggerStepThroughAttribute()]
  52. [System.ComponentModel.DesignerCategoryAttribute("code")]
  53. [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
  54. [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
  55. public partial class Demographics {
  56.  
  57. private DemographicsDemographic[] itemsField;
  58.  
  59. /// <remarks/>
  60. [System.Xml.Serialization.XmlElementAttribute("Demographic", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
  61. public DemographicsDemographic[] Items {
  62. get {
  63. return this.itemsField;
  64. }
  65. set {
  66. this.itemsField = value;
  67. }
  68. }
  69. }
  70.  
  71. /// <remarks/>
  72. [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
  73. [System.SerializableAttribute()]
  74. [System.Diagnostics.DebuggerStepThroughAttribute()]
  75. [System.ComponentModel.DesignerCategoryAttribute("code")]
  76. [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
  77. public partial class DemographicsDemographic {
  78.  
  79. private string nameField;
  80.  
  81. private string valueField;
  82.  
  83. /// <remarks/>
  84. [System.Xml.Serialization.XmlAttributeAttribute()]
  85. public string Name {
  86. get {
  87. return this.nameField;
  88. }
  89. set {
  90. this.nameField = value;
  91. }
  92. }
  93.  
  94. /// <remarks/>
  95. [System.Xml.Serialization.XmlTextAttribute()]
  96. public string Value {
  97. get {
  98. return this.valueField;
  99. }
  100. set {
  101. this.valueField = value;
  102. }
  103. }
  104. }
  105.  
  106. [System.Xml.Serialization.XmlText()]
  107. public string Value { get; set; }
Add Comment
Please, Sign In to add comment