re: Xml Serialization
hi people,
i losing mind on problem:
here classes:
[
xmlroot("baseflightsector")][
xmlinclude(typeof(flightsector))] public class baseflightsector{}[
xmlroot("flightsector")] public class flightsector : baseflightsector{}[
xmlroot("flightsectors")] public class flightsectors : list<flightsector>{}
i proceed serialize these classes:
flightsectors fs = new flightsectors();
flightsector f = new flightsector();
fs.add(f);
using (stringwriter sw = new stringwriter())
{
xmlserializer xs = new xmlserializer(typeof(flightsectors));
xmlserializernamespaces ns = new xmlserializernamespaces();
ns.add(string.empty, string.empty);
xs.serialize(sw, fs, ns);
console.writeline(sw.tostring());
}
and get:
flightsectors
flightsector/
flightsectors
when want:
flightsectors
flightsector /
/flightsectors
what's going on? sorry poor xml keeps disappearing.
as always, in advance,
koder
[xmltype(typename = "flightsector")]
public class flightsector : baseflightsector { }
-shreyas
Archived Forums A-B > ASMX Web Services and XML Serialization
Comments
Post a Comment