Link to home
Start Free TrialLog in
Avatar of DislocatedGI
DislocatedGI

asked on

Manipulating the output of empty XML elements for .NET serialization

Greetings,

I need to find out how to manipulate the serialization of objects for empty elements.  Specifically my requirement is to pass a <xmlnode></xmlnode> for empty nodes versus <xmlnode/>.  

I am using the XML serializer to do this.  

I tried setting my object as object.node = string.empty, but this only construct xml documents with nodes as <node/>.  

The other technique i tried was setting a blank space like object.node = " ", but this also is being constructed as <node/>.  

Any ideas how I can force a "full" xml element that is empty?
ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DislocatedGI
DislocatedGI

ASKER

Thank you for the quick response and solution.
Your welcome! :)

However, I would like to point out one small thing. I see that you have been around here for a while but have not asked many question at all, so I'm guessing that you may not be aware of the "grading tips".

http://support.experts-exchange.com/customer/portal/articles/481419

If upon reading the above, you would like to change the grade assigned to this question, you can click the "Request Attention" link that is located just below your original question, and an Admin can help further. This may seem like a insignificant issue, but the reason that I raise it is that if you were to ask more questions in the future, some experts will look at the gradings that you have assigned to previous questions before attempting to answer, and so you are more likely to get help from everyone here on EE if your gradings follow the general advice in those tips above.
Sorry for the late response.  I was tied uptight family stuff.

How do I go about changing the grade?  I looked for the request attention link
 Mccarl references.

Now that I read the grading practices I would like to change it to an A.