XmlWriterSettings コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > XmlWriterSettings コンストラクタの意味・解説 

XmlWriterSettings コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

XmlWriterSettings クラス新しインスタンス初期化します。

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

Dim instance As New XmlWriterSettings
public XmlWriterSettings ()
public:
XmlWriterSettings ()
public XmlWriterSettings ()
public function XmlWriterSettings ()
解説解説

XmlWriterSettingsインスタンス初期プロパティ値を次の表に示します

プロパティ

初期値

CheckCharacters

true

CloseOutput

false

ConformanceLevel

Document

Encoding

Encoding.UTF8

Indent

false

IndentChars

2 個の空白

NewLineChars

\r\n (復帰改行)

NewLineHandling

Replace

NewLineOnAttributes

false

OmitXmlDeclaration

false

使用例使用例

インデントタブ文字使用する XmlWriter オブジェクト作成する例を次に示します

Imports System
Imports System.IO
Imports System.Xml
Imports System.Text
Imports Microsoft.VisualBasic

Public Class Sample 

  Public Shared Sub Main()
 
  
    Dim writer As XmlWriter = Nothing

    Try 

       ' Create an XmlWriterSettings object with the correct options.
 
       Dim settings As XmlWriterSettings =
 New XmlWriterSettings()
       settings.Indent = true
       settings.IndentChars = (ControlChars.Tab)
       settings.OmitXmlDeclaration = true

       ' Create the XmlWriter object and write some content.
       writer = XmlWriter.Create("data.xml", settings)
       writer.WriteStartElement("book")
       writer.WriteElementString("item", "tesing")
       writer.WriteEndElement()
    
       writer.Flush()

      Finally
         If Not (writer Is
 Nothing) Then
            writer.Close()
         End If
      End Try

   End Sub 
End Class 
using System;
using System.IO;
using System.Xml;
using System.Text;

public class Sample {

  public static void Main()
 {
  
    XmlWriter writer = null;

    try {

       // Create an XmlWriterSettings object with the correct options.
 
       XmlWriterSettings settings = new XmlWriterSettings();
       settings.Indent = true;
       settings.IndentChars = ("\t");
       settings.OmitXmlDeclaration = true;

       // Create the XmlWriter object and write some content.
       writer = XmlWriter.Create("data.xml", settings);
       writer.WriteStartElement("book");
       writer.WriteElementString("item", "tesing");
       writer.WriteEndElement();
    
       writer.Flush();

     } 
     finally  {
        if (writer != null)
          writer.Close();
     }
  } 
} 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「XmlWriterSettings コンストラクタ」の関連用語

XmlWriterSettings コンストラクタのお隣キーワード
検索ランキング

   

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



XmlWriterSettings コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS