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

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

XmlElement.InnerText プロパティ

ノードとそのすべての子の連結している値を取得または設定します

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

Public Overrides Property
 InnerText As String
Dim instance As XmlElement
Dim value As String

value = instance.InnerText

instance.InnerText = value
public override string InnerText { get;
 set; }
/** @property */
public String get_InnerText ()

/** @property */
public void set_InnerText (String value)

プロパティ
ノードとそのすべての子の連結している値。

解説解説
使用例使用例

InnerText プロパティと InnerXml プロパティ比較する例を次に示します

Imports System
Imports System.Xml

public class Test

  public shared sub Main()

    Dim doc as XmlDocument = new
 XmlDocument()
    doc.LoadXml("<root>"& _
                "<elem>some text<child/>more text</elem>"
 & _
                "</root>")

    Dim elem as XmlElement
    elem = CType (doc.DocumentElement.ChildNodes.Item(0), XmlElement)

    ' Note that InnerText does not include the markup.
    Console.WriteLine("Display the InnerText of the element...")
    Console.WriteLine( elem.InnerText )

    ' InnerXml includes the markup of the element.
    Console.WriteLine("Display the InnerXml of the element...")
    Console.WriteLine(elem.InnerXml)

    ' Set InnerText to a string that includes markup.  
    ' The markup is escaped.
    elem.InnerText = "Text containing <markup/> will have
 char(<) and char(>) escaped."
    Console.WriteLine( elem.OuterXml )

    ' Set InnerXml to a string that includes markup.  
    'The markup is not escaped.
    elem.InnerXml = "Text containing <markup/>."
    Console.WriteLine( elem.OuterXml )
    
  end sub
end class
using System;
using System.Xml;
public class Test {

  public static void Main()
 {
    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<root>"+
                "<elem>some text<child/>more text</elem>"
 +
                "</root>");

    XmlElement elem = (XmlElement)doc.DocumentElement.FirstChild;

    // Note that InnerText does not include the markup.
    Console.WriteLine("Display the InnerText of the element...");
    Console.WriteLine( elem.InnerText );

    // InnerXml includes the markup of the element.
    Console.WriteLine("Display the InnerXml of the element...");
    Console.WriteLine(elem.InnerXml);

    // Set InnerText to a string that includes markup.  
    // The markup is escaped.
    elem.InnerText = "Text containing <markup/> will have char(<)
 and char(>) escaped.";
    Console.WriteLine( elem.OuterXml );

    // Set InnerXml to a string that includes markup.  
    // The markup is not escaped.
    elem.InnerXml = "Text containing <markup/>.";
    Console.WriteLine( elem.OuterXml );
  }
}
#using <System.Xml.dll>

using namespace System;
using namespace System::Xml;
int main()
{
   XmlDocument^ doc = gcnew XmlDocument;
   doc->LoadXml( "<root><elem>some text<child/>more text</elem></root>"
 );
   XmlElement^ elem = dynamic_cast<XmlElement^>(doc->DocumentElement->FirstChild);
   
   // Note that InnerText does not include the markup.
   Console::WriteLine( "Display the InnerText of the element..." );
   Console::WriteLine( elem->InnerText );
   
   // InnerXml includes the markup of the element.
   Console::WriteLine( "Display the InnerXml of the element..." );
   Console::WriteLine( elem->InnerXml );
   
   // Set InnerText to a string that includes markup.  
   // The markup is escaped.
   elem->InnerText = "Text containing <markup/> will have char(<)
 and char(>) escaped.";
   Console::WriteLine( elem->OuterXml );
   
   // Set InnerXml to a string that includes markup.  
   // The markup is not escaped.
   elem->InnerXml = "Text containing <markup/>.";
   Console::WriteLine( elem->OuterXml );
}

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

public class Test
{
    public static void main(String[]
 args)
    {
        XmlDocument doc = new XmlDocument();
        doc.LoadXml("<root>"
            + "<elem>some text<child/>more text</elem>"
 
            + "</root>");

        XmlElement elem = 
            (XmlElement)doc.get_DocumentElement().get_FirstChild();

        // Note that InnerText does not include the markup.
        Console.WriteLine("Display the InnerText of the element...");
        Console.WriteLine(elem.get_InnerText());

        // InnerXml includes the markup of the element.
        Console.WriteLine("Display the InnerXml of the element...");
        Console.WriteLine(elem.get_InnerXml());

        // Set InnerText to a string that includes markup.  
        // The markup is escaped.
        elem.set_InnerText("Text containing <markup/> will have "
 
            + "char(<) and char(>)
 escaped.");
        Console.WriteLine(elem.get_OuterXml());

        // Set InnerXml to a string that includes markup.  
        // The markup is not escaped.
        elem.set_InnerXml("Text containing <markup/>.");
        Console.WriteLine(elem.get_OuterXml());
    } //main
} //Test
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からXmlElement.InnerText プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からXmlElement.InnerText プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からXmlElement.InnerText プロパティを検索

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

辞書ショートカット

すべての辞書の索引

「XmlElement.InnerText プロパティ」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS