Loading ...
Sorry, an error occurred while loading the content.

XmlSerialization issue

Expand Messages
  • omkar singh
    hi, When I am serializing the array of following ParameterValueStruct class i didnot get 1 the type and size of array. 2 DataType of each element. It is
    Message 1 of 3 , Oct 3, 2005
    • 0 Attachment
      hi,
      When I am serializing the array of following ParameterValueStruct class i didnot get
      1> the type and size of array.
      2> DataType of each element. It is especially needed in  case of 'anyURI' DataType.
      I am using serializer class of XmlSerialization namespace of .NET framework.
       
      public class ParameterValueStruct
      {
       [XmlElement (ElementName = "Name")]
       public string parameterName;
       [XmlElement (ElementName = "Value")]
       public ParameterValueValue parameterValue;
      }
       
      Example of what am getting!
      ==========================
        <cwmp:ParameterList >
          <cwmp:ParameterValueStruct>
            <cwmp:Name>InternetGatewayDevice.DeviceInfo.HardwareVersion</cwmp:Name>
            <cwmp:Value>SKYN_PLUS</cwmp:Value>
          </cwmp:ParameterValueStruct>
          <cwmp:ParameterValueStruct>
            <cwmp:Name>InternetGatewayDevice.DeviceInfo</cwmp:Name>
            <cwmp:Value>BANT-K</cwmp:Value>
          </cwmp:ParameterValueStruct>
        </cwmp:ParameterList>
       
      Example of what i want
      ==========================
        <cwmp:ParameterList  arrayType="cwmp:ParameterValueStruct[2]">
          <cwmp:ParameterValueStruct>
            <cwmp:Name>InternetGatewayDevice.DeviceInfo.HardwareVersion</cwmp:Name>
            <cwmp:Value xsi:type="xsd:anyURI">SKYN_PLUS</cwmp:Value>
          </cwmp:ParameterValueStruct>
          <cwmp:ParameterValueStruct>
            <cwmp:Name>InternetGatewayDevice.DeviceInfo</cwmp:Name>
            <cwmp:Value xsi:type="xsd:anyURI">BANT-K</cwmp:Value>
          </cwmp:ParameterValueStruct>
        </cwmp:ParameterList>


      Yahoo! for Good
      Click here to donate to the Hurricane Katrina relief effort.
    • Duncan Mak
      ... You need to use the [XmlAttribute] attribute to specify what attribute(s) to add to the elements. Duncan.
      Message 2 of 3 , Oct 3, 2005
      • 0 Attachment
        On 10/3/05, omkar singh <omkar_s_2000@...> wrote:
        hi,
        When I am serializing the array of following ParameterValueStruct class i didnot get
        1> the type and size of array.
        2> DataType of each element. It is especially needed in  case of 'anyURI' DataType.
        I am using serializer class of XmlSerialization namespace of .NET framework.

        You need to use the [XmlAttribute] attribute to specify what attribute(s) to add to the elements.

        Duncan.


      • omkar singh
        Can u specify the specific XmlAttribute for showing the size of arrray? How to apply XmlAttribute to member of class? And I am using DataType
        Message 3 of 3 , Oct 3, 2005
        • 0 Attachment
          Can u specify the specific XmlAttribute for showing the size of arrray?
          How to apply XmlAttribute to member of class?
          And I am using DataType XmlElementAttribute for a member 'parmeterValue' but the serialized document doesn't reflect that.

          Duncan Mak <duncanmak@...> wrote:
          On 10/3/05, omkar singh <omkar_s_2000@...> wrote:
          hi,
          When I am serializing the array of following ParameterValueStruct class i didnot get
          1> the type and size of array.
          2> DataType of each element. It is especially needed in  case of 'anyURI' DataType.
          I am using serializer class of XmlSerialization namespace of .NET framework.

          You need to use the [XmlAttribute] attribute to specify what attribute(s) to add to the elements.

          Duncan.




          Omkar Singh
          Consultant
          Jopasana Software & Systems Pvt. Ltd.


          Yahoo! for Good
          Click here to donate to the Hurricane Katrina relief effort.

        Your message has been successfully submitted and would be delivered to recipients shortly.