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

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

XmlElement.InnerXml プロパティ

このノードの子だけを表すマークアップ取得または設定します

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

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

value = instance.InnerXml

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

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

プロパティ
このノードの子マークアップ

例外例外
例外種類条件

XmlException

このプロパティ設定したときに指定した XML は、整形式ではありません。

解説解説
使用例使用例

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.InnerXml プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からXmlElement.InnerXml プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からXmlElement.InnerXml プロパティ を検索

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

辞書ショートカット

すべての辞書の索引

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

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

   

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



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

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

©2025 GRAS Group, Inc.RSS