Ignore:
Timestamp:
Mar 3, 2008, 10:15:06 PM (16 years ago)
Author:
dai
Message:

System/Xml/Serialization/XmlSerializer.abを追加。
まずはシリアライズ処理を動くようにした。
※逆シリアライズは未実装なので、ActiveBasic.Xml.Parserクラスを実装してから対応すること。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/Xml/XmlDocument.ab

    r451 r452  
    9494
    9595    /*!
     96    @brief  指定したストリームからXML文書を読み込む。
     97    @param  stream 読み込み先のストリーム。
     98    */
     99    Virtual Sub Load( inStream As System.IO.Stream )
     100        Dim length = inStream.Length As DWord
     101        Dim xmlBuffer = calloc( length + 1 ) As *StrChar
     102        inStream.Read( xmlBuffer As *Byte, 0, length )
     103        Dim xmlString = New String( xmlBuffer )
     104        free( xmlBuffer )
     105
     106        This.RemoveAll()
     107        ActiveBasic.Xml.Parser.Parse( xmlString, This )
     108    End Sub
     109
     110    /*!
     111    @brief  指定したファイルからXML文書を読み込む。
     112    @param  ファイルパス。
     113    */
     114    Virtual Sub Load( filename As String )
     115        Dim fileStream As System.IO.FileStream( filename, System.IO.FileMode.Open, System.IO.FileAccess.Read )
     116        Load( fileStream )
     117    End Sub
     118
     119    /*!
    96120    @brief  指定したストリームにXML文書を保存する。
    97121    @param  stream 保存先のストリーム。
     
    107131    */
    108132    Virtual Sub Save( filename As String )
    109         Dim fileStream As System.IO.FileStream( filename, System.IO.FileMode.Create )
     133        Dim fileStream As System.IO.FileStream( filename, System.IO.FileMode.Create, System.IO.FileAccess.Write )
    110134        Save( fileStream )
    111135    End Sub
    112136
     137Private
     138    Sub LoadXmlString( xmlString As String)
     139    End Sub
    113140End Class
    114141
Note: See TracChangeset for help on using the changeset viewer.