Last change
on this file since 471 was 468, checked in by イグトランス (egtra), 17 years ago |
TextWriter, StreamWriterの追加。
SPrintfの浮動小数点数変換で、NaN, Infiniteの出力に対応。
PathとDirectoryInfoのCreateDirectoryで、対象が既に存在するときには例外を投げないように修正。
SimpleTestCase内で使用する一時フォルダの場所にGetTempPathで取得する版を追加(コメントアウト)。
|
File size:
838 bytes
|
Line | |
---|
1 | Namespace XmlTest
|
---|
2 |
|
---|
3 |
|
---|
4 | Sub TestMain()
|
---|
5 | ' 一時ディレクトリを取得
|
---|
6 | Dim tempDir = GetExclusiveTempDirPath( "XmlTest" )
|
---|
7 |
|
---|
8 | Dim doc = New System.Xml.XmlDocument()
|
---|
9 | doc.AppendChild( doc.CreateXmlDeclaration( "1.0", "shift-jis", Nothing ) )
|
---|
10 | doc.AppendChild( doc.CreateElement( "root" ) )
|
---|
11 | doc.ChildNodes[1].AppendChild( doc.CreateElement( "test" ) )
|
---|
12 |
|
---|
13 | Dim attr1 = doc.CreateAttribute( "attr1" )
|
---|
14 | attr1.Value = "123"
|
---|
15 | doc.ChildNodes[1].Attributes.Add( attr1 )
|
---|
16 | Dim attr2 = doc.CreateAttribute( "attr2" )
|
---|
17 | attr2.Value = "456"
|
---|
18 | doc.ChildNodes[1].Attributes.Add( attr2 )
|
---|
19 |
|
---|
20 | ' 書いて
|
---|
21 | doc.Save( tempDir + "test.xml" )
|
---|
22 |
|
---|
23 | ' 読んで
|
---|
24 | Dim clone = New System.Xml.XmlDocument
|
---|
25 | clone.Load( tempDir + "test.xml" )
|
---|
26 |
|
---|
27 | ' 比較してみる
|
---|
28 | UnitTest( "XmlTest", doc.OuterXml = clone.OuterXml )
|
---|
29 | End Sub
|
---|
30 |
|
---|
31 |
|
---|
32 | End Namespace
|
---|
33 |
|
---|
34 | XmlTest.TestMain()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.