XmlDocument.PreserveWhitespace プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > XmlDocument.PreserveWhitespace プロパティの意味・解説 

XmlDocument.PreserveWhitespace プロパティ

要素コンテンツにある空白保存するかどうかを示す値を取得または設定します

名前空間: System.Xml
アセンブリ: System.Xml (system.xml.dll 内)
構文構文

Public Property PreserveWhitespace As
 Boolean
Dim instance As XmlDocument
Dim value As Boolean

value = instance.PreserveWhitespace

instance.PreserveWhitespace = value
public bool PreserveWhitespace { get;
 set; }
public:
property bool PreserveWhitespace {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_PreserveWhitespace ()

/** @property */
public void set_PreserveWhitespace (boolean
 value)
public function get PreserveWhitespace
 () : boolean

public function set PreserveWhitespace
 (value : boolean)

プロパティ
空白である場合trueそれ以外場合false既定値false です。

解説解説
使用例使用例

ファイルか空白取り除く方法次の例に示します

Imports System
Imports System.IO
Imports System.Xml

public class Sample

  public shared sub Main()

    'Load XML data which includes white space, but ignore
    'any white space in the file.
    Dim doc as XmlDocument = new
 XmlDocument()
    doc.PreserveWhitespace = false
    doc.Load("book.xml")

    'Save the document as is (no white space).
    Console.WriteLine("Display the modified XML...")
    doc.PreserveWhitespace = true
    doc.Save(Console.Out)

  end sub
end class
using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
    //Load XML data which includes white space, but ignore
    //any white space in the file.
    XmlDocument doc = new XmlDocument();
    doc.PreserveWhitespace = false;
    doc.Load("book.xml");

    //Save the document as is (no white space).
    Console.WriteLine("Display the modified XML...");
    doc.PreserveWhitespace = true;
    doc.Save(Console.Out);

   }
}
#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   
   //Load XML data which includes white space, but ignore
   //any white space in the file.
   XmlDocument^ doc = gcnew XmlDocument;
   doc->PreserveWhitespace = false;
   doc->Load( "book.xml" );
   
   //Save the document as is (no white space).
   Console::WriteLine( "Display the modified XML..." );
   doc->PreserveWhitespace = true;
   doc->Save( Console::Out );
}

import System.*;
import System.IO.*;
import System.Xml.*;

public class Sample
{
    public static void main(String[]
 args)
    {
        // Load XML data which includes white space, but ignore
        // any white space in the file.
        XmlDocument doc = new XmlDocument();
        doc.set_PreserveWhitespace(false);
        doc.Load("book.xml");

        // Save the document as is (no white space).
        Console.WriteLine("Display the modified XML...");
        doc.set_PreserveWhitespace(true);
        doc.Save(Console.get_Out());
    } //main 
} //Sample

この例では、入力として、book.xml というファイル使用してます。

<!--sample XML fragment-->
<book genre='novel' ISBN='1-861003-78'
 misc='sale-item'>
  <title>The Handmaid's
 Tale</title>
  <price>14.95</price>
</book>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「XmlDocument.PreserveWhitespace プロパティ」の関連用語

XmlDocument.PreserveWhitespace プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



XmlDocument.PreserveWhitespace プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS