Ignore:
Timestamp:
Mar 13, 2008, 9:44:51 AM (16 years ago)
Author:
dai
Message:

XmlSerializer.Deserializeメソッドを実装(仮実装なため、数値メンバのシリアライズのみに留まっている)。
XmlNode.LastChildメソッドを追加。
XmlNode.NextSiblingメソッドを追加。
XmlNode.PreviouseSiblingメソッドを追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/TestCase/SimpleTestCase/SerializeTest.ab

    r465 r475  
    11Namespace SerializeTest
    22
     3
    34Class Foo
     5Public
    46    a As Long
    57    b As Long
    68    c As Long
    79    d As Long
    8 Public
     10
    911    Sub Foo()
    1012        a=100
     
    2123    ' fooインスタンスを生成
    2224    Dim foo = New Foo
     25    foo.a = 500
     26    foo.b = 600
     27    foo.c = 700
     28    foo.d = 800
    2329
    2430
     
    2935    ' 保存先のファイルを開いて、
    3036    Dim fooXmlFilePath = tempDir + "\foo.xml"
    31     Dim fs = New System.IO.FileStream( fooXmlFilePath, System.IO.FileMode.Create )
     37    Dim ofs = New System.IO.FileStream( fooXmlFilePath, System.IO.FileMode.Create )
    3238
    3339    ' シリアライズして、
    3440    Dim serializer = New System.Xml.Serialization.XmlSerializer( foo.GetType() )
    35     serializer.Serialize( fs, foo )
     41    serializer.Serialize( ofs, foo )
    3642
    3743    ' 閉じる。
    38     fs.Close()
     44    ofs.Close()
    3945
    4046
     
    4349    '----------------------------------------------------------------
    4450
    45     ' 読み込んでみる。
    46     Dim doc = New System.Xml.XmlDocument
    47     doc.Load( tempDir + "\foo.xml" )
    48     System.Diagnostics.Debug.WriteLine( doc.OuterXml )
     51    ' 読込先のファイルを開いて
     52    Dim ifs = New System.IO.FileStream( fooXmlFilePath, System.IO.FileMode.Open )
    4953
    50     ' TODO: デシリアライズは未完成( ̄□ ̄;)
     54    ' デシリアライズして
     55    Dim fooDash = serializer.Deserialize( ifs ) As Foo
     56
     57    ' 閉じる
     58    ifs.Close()
     59
     60    UnitTest( "XmlSerializer", foo.a = fooDash.a and foo.b = fooDash.b and foo.c = fooDash.c and foo.d = fooDash.d  )
    5161End Sub
    5262
Note: See TracChangeset for help on using the changeset viewer.