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

public: virtual property String^ InnerXml { String^ get () override; void set (String^ value) override; }
/** @property */ public String get_InnerXml () /** @property */ public void set_InnerXml (String value)
public override function get InnerXml () : String public override function set InnerXml (value : String)
このノードの子のマークアップ。


このプロパティを設定すると、ノードの子を指定された文字列の解析済みの内容に置き換えます。解析は、現在の名前空間コンテキストで実行されます。
このプロパティは、ドキュメント オブジェクト モデル (DOM: Document Object Model) に対する Microsoft 拡張機能です。

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

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

- XmlElement.InnerXml プロパティのページへのリンク