This project is read-only.

Understanding Output

May 12, 2014 at 4:16 PM
If I use the .Net XML Serializer on this class:
public class Tester
    public string Name { get; set; }
    public int Age { get; set; }
    public DateTime Birth { get; set; }
    public DateTime Death { get; set; }
It returns the following output:
<?xml version="1.0" encoding="utf-8"?>\
<Tester xmlns:xsi="" xmlns:xsd="">

When I serialize the same class and data using Sharp Serializer I get this output:

<Complex name="Root" type="ConsoleApplication3.Tester, ConsoleApplication3, Version=, Culture=neutral, PublicKeyToken=null">
<Simple name="Name" value="One" />
<Simple name="Age" value="40" />
<Simple name="Birth" value="01/01/1974 00:00:00" />
<Simple name="Death" value="01/01/0001 00:00:00" />

Can I get the XML Serialization output from Sharp Serializer? In other words, can I get the element name to be the Field Names instead of the XSD Data Types?

Thanks for any help.
May 12, 2014 at 6:58 PM
hi, there is no possiblity for storing SharpSerializer data as the XmlSerializer XML. SharpSerializer serializes additional information like type information of inherited objects XmlSerializer is provided with this type information in its Serialize method.

if you serialize simple classes without their inheritance - I would suggest using XmlSerializer.