/// <summary>
/// Methord used to create Xml By Passing the Object without root node
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static XmlDocument ObjectTOXmlTemp(object obj)
{
XmlDocument xDoc;
MemoryStream tempStream = new MemoryStream();
xDoc = new XmlDocument();
try
{
// Create an XmlSerializer instance using the method below.
XmlSerializer myXmlSerializer = CreateOverrider(obj.GetType());
myXmlSerializer.Serialize(tempStream, obj);
tempStream.Position = 0;
xDoc.Load(tempStream);
}
catch
{
}
finally
{
tempStream.Close();
tempStream.Dispose();
}
return xDoc;
}
/// Methord used to create Xml By Passing the Object without root node
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static XmlDocument ObjectTOXmlTemp(object obj)
{
XmlDocument xDoc;
MemoryStream tempStream = new MemoryStream();
xDoc = new XmlDocument();
try
{
// Create an XmlSerializer instance using the method below.
XmlSerializer myXmlSerializer = CreateOverrider(obj.GetType());
myXmlSerializer.Serialize(tempStream, obj);
tempStream.Position = 0;
xDoc.Load(tempStream);
}
catch
{
}
finally
{
tempStream.Close();
tempStream.Dispose();
}
return xDoc;
}
No comments:
Post a Comment