XmlTextWriter.Indentation プロパティ
アセンブリ: System.Xml (system.xml.dll 内)

Dim instance As XmlTextWriter Dim value As Integer value = instance.Indentation instance.Indentation = value
/** @property */ public int get_Indentation () /** @property */ public void set_Indentation (int value)
各レベルの IndentChars の数。既定値は 2 です。


![]() |
---|
Microsoft .NET Framework version 2.0 リリースでは、System.Xml.XmlWriter.Create メソッドと XmlWriterSettings クラスを使用して XmlWriter インスタンスを作成することをお勧めします。これにより、このリリースで導入されたすべての新機能を十分に活用できます。詳細については、「XML ライタの作成」を参照してください。 |
インデントは、DocumentType、Element、Comment、ProcessingInstruction、および CDATASection の各ノード型に対して実行されます。その他のノード型は影響を受けません。XmlTextWriter は、内部 DTD サブセットにインデント幅を適用しません。ただし、次を実行すると、内部 DTD サブセットに書式設定を適用できます。
String name = "Employees"; String pubid = null; String sysid = null; String subset = @" <!ELEMENT Employees (Employee)+> <!ELEMENT Employee EMPTY> <!ATTLIST Employee firstname CDATA #REQUIRED> <!ENTITY Company 'Microsoft'>]> "; XmlTextWriter tw = new XmlTextWriter(Console.Out); tw.WriteDocType(name, pubid, sysid, subset);

Option Explicit Option Strict Imports System Imports System.IO Imports System.Xml Public Class Sample Public Shared Sub Main() 'Create a writer to write XML to the console. Dim writer As XmlTextWriter = Nothing writer = New XmlTextWriter(Console.Out) 'Use indentation for readability. writer.Formatting = Formatting.Indented writer.Indentation = 4 'Write an element (this one is the root). writer.WriteStartElement("book") 'Write the title element. writer.WriteStartElement("title") writer.WriteString("Pride And Prejudice") writer.WriteEndElement() 'Write the close tag for the root element. writer.WriteEndElement() 'Write the XML to file and close the writer. writer.Close() End Sub 'Main End Class 'Sample
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { //Create a writer to write XML to the console. XmlTextWriter writer = null; writer = new XmlTextWriter (Console.Out); //Use indentation for readability. writer.Formatting = Formatting.Indented; writer.Indentation = 4; //Write an element (this one is the root). writer.WriteStartElement("book"); //Write the title element. writer.WriteStartElement("title"); writer.WriteString("Pride And Prejudice"); writer.WriteEndElement(); //Write the close tag for the root element. writer.WriteEndElement(); //Write the XML to file and close the writer. writer.Close(); } }
#using <System.Xml.dll> using namespace System; using namespace System::IO; using namespace System::Xml; int main() { //Create a writer to write XML to the console. XmlTextWriter^ writer = nullptr; writer = gcnew XmlTextWriter( Console::Out ); //Use indentation for readability. writer->Formatting = Formatting::Indented; writer->Indentation = 4; //Write an element (this one is the root). writer->WriteStartElement( "book" ); //Write the title element. writer->WriteStartElement( "title" ); writer->WriteString( "Pride And Prejudice" ); writer->WriteEndElement(); //Write the close tag for the root element. writer->WriteEndElement(); //Write the XML to file and close the writer. writer->Close(); }
import System.*; import System.IO.*; import System.Xml.*; public class Sample { public static void main(String[] args) { //Create a writer to write XML to the console. XmlTextWriter writer = null; writer = new XmlTextWriter(Console.get_Out()); //Use indentation for readability. writer.set_Formatting(Formatting.Indented); writer.set_Indentation(4); //Write an element (this one is the root). writer.WriteStartElement("book"); //Write the title element. writer.WriteStartElement("title"); writer.WriteString("Pride And Prejudice"); writer.WriteEndElement(); //Write the close tag for the root element. writer.WriteEndElement(); //Write the XML to file and close the writer. writer.Close(); } //main } //Sample

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からXmlTextWriter.Indentation プロパティを検索する場合は、下記のリンクをクリックしてください。

- XmlTextWriter.Indentation プロパティのページへのリンク