Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I have this code which converts an object to xmldocument but while doing that i get this error

The code is which returns the xmldocument is below :

C#
public static XmlDocument ToXmlDocument(this MyClass myclass)
        {
            var result = new XmlDocument();
            var xml = myclass.ToXml(true, Formatting.Indented, EOLType.CRLF, Helpers.XmlSerializationContext());
            result.LoadXml(xml);
            return result;
        }


I think something is fishy there when i am converting object to xml

can someone please suggest what is wrong in there

Best,
Hg
Posted
Updated 10-Jun-14 21:00pm
v2
Comments
Kornfeld Eliyahu Peter 10-Jun-14 16:22pm    
Show MyClass and show ToXml to us...
Harshad Gharote 10-Jun-14 18:09pm    
Hey Peter,

MyClass contains a lot of string variables and methods
ToXml is from Liquid Technologies dlls

Kornfeld Eliyahu Peter 11-Jun-14 1:58am    
Why not ask them?

1 solution

I can't understand why you are using some 3rd party extension to serialize an object to XML, but if this is a requirement then go and ask the 3rd party for support!
If you can choose your way, than you be better with the simple .NET way of XML serialization (and deserialization)...
Start reading here: XML Serialization and Deserialization: Part-1[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900