- 日時: 2008/11/05 16:31
- 名前: lightbox
- ***********************************************************************************
* カテゴリー:[ファイル入出力][文字列処理][] * * キーワード:文字コード,DOMで,XML,UTF-8N,, * ***********************************************************************************
Imports System.IO Imports System.Text
Module MyModule
' ******************************************************** ' * 実行 ' ******************************************************** Sub Main()
Dim Doc As New Xml.XmlDocument()
Dim strData As String = _ "<?xml version=""1.0"" encoding=""UTF-8""?>" + _ "<data>" + _ "<row>" + _ "<col type=""氏名"">山田 太郎</col>" + _ "<col type=""フリガナ"">ヤマダ タロウ</col>" + _ "<col type=""NO"">1234567890</col>" + _ "</row>" + _ "</data>"
Doc.LoadXml(strData)
' BOM あり Doc.Save( "mydata_bom.xml" )
' BOM 無し Dim utf8NoBOM As New UTF8Encoding() Dim xmlWriter As StreamWriter = New StreamWriter( "mydata.xml", False, utf8NoBOM ) Doc.Save( xmlWriter ) xmlWriter.Close() xmlWriter.Dispose()
End Sub
End Module
|