XmlDocument.CreateSignificantWhitespace メソッド
アセンブリ: System.Xml (system.xml.dll 内)

Public Overridable Function CreateSignificantWhitespace ( _ text As String _ ) As XmlSignificantWhitespace
Dim instance As XmlDocument Dim text As String Dim returnValue As XmlSignificantWhitespace returnValue = instance.CreateSignificantWhitespace(text)
戻り値
新しい XmlSignificantWhitespace ノード。

このメソッドは、DOM (Document Object Model) に対する Microsoft 拡張機能です。ドキュメントを手動で書式指定するときに使用します。
このメソッドは、ドキュメントのコンテキスト内で新しいオブジェクトを作成しますが、自動的には新しいオブジェクトをドキュメント ツリーに追加しません。新しいオブジェクトを追加するには、ノード挿入メソッドのいずれか 1 つを明示的に呼び出す必要があります。

Option Explicit Option Strict Imports System Imports System.Xml Imports Microsoft.VisualBasic Public Class Sample Public Shared Sub Main() Dim doc As New XmlDocument() doc.LoadXml("<author xml:space='preserve'>" & _ "<first-name>Eva</first-name>" & _ "<last-name>Corets</last-name>" & _ "</author>") Console.WriteLine("InnerText before...") Console.WriteLine(doc.DocumentElement.InnerText) ' Add white space. Dim currNode as XmlNode = doc.DocumentElement Dim sigws As XmlSignificantWhitespace = doc.CreateSignificantWhitespace(ControlChars.Tab) currNode.InsertAfter(sigws, currNode.FirstChild) Console.WriteLine() Console.WriteLine("InnerText after...") Console.WriteLine(doc.DocumentElement.InnerText) End Sub End Class 'Sample
using System; using System.Xml; public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.LoadXml("<author xml:space='preserve'>" + "<first-name>Eva</first-name>"+ "<last-name>Corets</last-name>" + "</author>"); Console.WriteLine("InnerText before..."); Console.WriteLine(doc.DocumentElement.InnerText); // Add white space. XmlNode currNode = doc.DocumentElement; XmlSignificantWhitespace sigws = doc.CreateSignificantWhitespace("\t"); currNode.InsertAfter(sigws, currNode.FirstChild); Console.WriteLine(); Console.WriteLine("InnerText after..."); Console.WriteLine(doc.DocumentElement.InnerText); } }
#using <System.Xml.dll> using namespace System; using namespace System::Xml; int main() { XmlDocument^ doc = gcnew XmlDocument; doc->LoadXml( "<author xml:space='preserve'><first-name>Eva</first-name><last-name>Corets</last-name></author>" ); Console::WriteLine( "InnerText before..." ); Console::WriteLine( doc->DocumentElement->InnerText ); // Add white space. XmlNode^ currNode = doc->DocumentElement; XmlSignificantWhitespace^ sigws = doc->CreateSignificantWhitespace( "\t" ); currNode->InsertAfter( sigws, currNode->FirstChild ); Console::WriteLine(); Console::WriteLine( "InnerText after..." ); Console::WriteLine( doc->DocumentElement->InnerText ); }
import System.*; import System.Xml.*; public class Sample { public static void main(String[] args) { XmlDocument doc = new XmlDocument(); doc.LoadXml("<author xml:space='preserve'>" + "<first-name>Eva</first-name>" + "<last-name>Corets</last-name>" + "</author>"); Console.WriteLine("InnerText before..."); Console.WriteLine(doc.get_DocumentElement().get_InnerText()); // Add white space. XmlNode currNode = doc.get_DocumentElement(); XmlSignificantWhitespace sigWs = doc.CreateSignificantWhitespace("\t"); currNode.InsertAfter(sigWs, currNode.get_FirstChild()); Console.WriteLine(); Console.WriteLine("InnerText after..."); Console.WriteLine(doc.get_DocumentElement().get_InnerText()); } //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に収録されているすべての辞書からXmlDocument.CreateSignificantWhitespace メソッドを検索する場合は、下記のリンクをクリックしてください。

- XmlDocument.CreateSignificantWhitespace メソッドのページへのリンク