Xml Serialize Empty object

J

Jayesh Modha

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
 
J

Jayesh Modha

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

George.


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top