Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

XmlDocument.CreateWhitespace メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > XmlDocument.CreateWhitespace メソッドの意味・解説 

XmlDocument.CreateWhitespace メソッド

XmlWhitespace ノード作成します

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

Public Overridable Function
 CreateWhitespace ( _
    text As String _
) As XmlWhitespace
Dim instance As XmlDocument
Dim text As String
Dim returnValue As XmlWhitespace

returnValue = instance.CreateWhitespace(text)
public virtual XmlWhitespace CreateWhitespace (
    string text
)
public:
virtual XmlWhitespace^ CreateWhitespace (
    String^ text
)
public XmlWhitespace CreateWhitespace (
    String text
)
public function CreateWhitespace (
    text : String
) : XmlWhitespace

パラメータ

text

文字列には、、
、
、および 	 の文字だけを含める必要があります

戻り値
新しXmlWhitespace ノード

解説解説
使用例使用例

ドキュメント空白追加する例を次に示します

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>" & _
                    "<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 ws As XmlWhitespace = doc.CreateWhitespace(ControlChars.CrLf)
        currNode.InsertAfter(ws, 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>" +
                  "<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;
      XmlWhitespace ws = doc.CreateWhitespace("\r\n");
      currNode.InsertAfter(ws, 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><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;
   XmlWhitespace^ ws = doc->CreateWhitespace( "\r\n" );
   currNode->InsertAfter( ws, 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>"
                    + "<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();
        XmlWhitespace ws = doc.CreateWhitespace("\r\n");
        currNode.InsertAfter(ws, currNode.get_FirstChild());

        Console.WriteLine();
        Console.WriteLine("InnerText after...");
        Console.WriteLine(doc.get_DocumentElement().get_InnerText());
    } //main
} //Sample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

XmlDocument.CreateWhitespace メソッドのお隣キーワード
検索ランキング

   

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



XmlDocument.CreateWhitespace メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS