Xml Serialize Empty object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jayesh Modha

    Xml Serialize Empty object

    I am trying to build a soap envelope by looking at object parameter
    type.
    if my object is empty, it's xml tag is not generated by xml
    serializer.
    Is there anyway I can generate the xml tag even if the object is
    empty.

    Thanks,
    Jayesh
  • George

    #2
    Re: Xml Serialize Empty object

    See if [XmlElement(IsNu llable=true)] will work for you

    George.

    "Jayesh Modha" <jayesh.modha@g mail.comwrote in message
    news:2e1e9ffe-e2b6-46d0-b27d-6816b3258b7f@r3 6g2000prf.googl egroups.com...
    >I am trying to build a soap envelope by looking at object parameter
    type.
    if my object is empty, it's xml tag is not generated by xml
    serializer.
    Is there anyway I can generate the xml tag even if the object is
    empty.
    >
    Thanks,
    Jayesh

    Comment

    • Jayesh Modha

      #3
      Re: Xml Serialize Empty object

      On Oct 26, 4:56 pm, "George" <noem...@comcas t.netwrote:
      See if [XmlElement(IsNu llable=true)] will work for you
      >
      George.
      >
      "Jayesh Modha" <jayesh.mo...@g mail.comwrote in message
      >
      news:2e1e9ffe-e2b6-46d0-b27d-6816b3258b7f@r3 6g2000prf.googl egroups.com...
      >
      I am trying to build a soap envelope by looking at object parameter
      type.
      if my object is empty, it's xml tag is not generated by xml
      serializer.
      Is there anyway I can generate the xml tag even if the object is
      empty.
      >
      Thanks,
      Jayesh
      Thanks a lot. I have implemented a custom xml serializer which would
      give me the exact soap envelope.
      The idea I used is that as follows.
      1. Prepared the list of system types that directly converts to
      xmltags
      2. check the parameter type and see if that directly converts to xml,
      then create xml tag for that type.
      3. if that type is not directly xml convertible then check if it is
      Enum or Array or Class. and do recursive check in Class type.

      this idea has given me the exact soap envelope. now I have another
      approach, I can still use the solution you have given.
      Thanks,
      Jayesh Modha

      Comment

      Working...