Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/19/09 14:19:58 (16 years ago)
Author:
epitzer
Message:

Convenience method for XML serialization and de-serizliation. (#506)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs

    r1362 r1363  
    154154      r.dict.Add("two", 2);
    155155      r.dict.Add("three", 3);
    156       Serializer s = new Serializer(r, ConfigurationService.Instance.GetDefaultConfig(XmlFormat.Instance));       
    157       XmlGenerator xmlGenerator = new XmlGenerator();
    158       StreamWriter writer = new StreamWriter("test.xml");
    159       foreach (ISerializationToken token in s) {
    160         string line = xmlGenerator.Format(token);
    161         writer.Write(line);
    162         Console.Out.Write(line);
    163       }
    164       writer.Close();
    165       writer = new StreamWriter("test-types.xml");
    166       foreach (string line in xmlGenerator.Format(s.TypeCache)) {
    167         writer.WriteLine(line);
    168         Console.Out.WriteLine(line);
    169       }
    170       writer.Close();
    171      
    172       XmlParser parser = new XmlParser(new StreamReader("test.xml"));
    173       DeSerializer deSerializer = new DeSerializer(
    174         XmlParser.ParseTypeCache(new StreamReader("test-types.xml")));       
    175       object o = deSerializer.DeSerialize(parser);     
     156      XmlGenerator.Serialize(r, "test");           
     157      object o = XmlParser.DeSerialize("test");
    176158      Console.Out.WriteLine(Util.AutoFormat(o, true));     
    177159    }
Note: See TracChangeset for help on using the changeset viewer.