このノードの子を表すマークアップを取得または設定します。
Overrides Public Property InnerXml As String
[C#]
public override string InnerXml {get; set;}
[C++]
public: __property String* get_InnerXml();public: __property void set_InnerXml(String*);
[JScript]
public override function get InnerXml() : String;public override function set InnerXml(String);
プロパティ値
このノードの子のマークアップ。
例外
例外の種類 | 条件 |
---|---|
XmlException | このプロパティを設定したときに指定した XML は、整形式ではありません。 |
解説
このプロパティを設定すると、ノードの子を指定された文字列の解析済みの内容に置き換えます。解析は、現在の名前空間コンテキストで実行されます。
このプロパティは、ドキュメント オブジェクト モデル (DOM: Document Object Model) に対する Microsoft 拡張機能です。
使用例
[Visual Basic, C#, C++] InnerXml プロパティを使用してドキュメントのフラグメントの内容を設定する例を次に示します。
Option Explicit
Option Strict
Imports System
Imports System.IO
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
' Create the XmlDocument.
Dim doc As New XmlDocument()
' Create a document fragment.
Dim docFrag As XmlDocumentFragment = doc.CreateDocumentFragment()
' Set the contents of the document fragment.
docFrag.InnerXml = "<item>widget</item>"
' Display the document fragment.
Console.WriteLine(docFrag.InnerXml)
End Sub 'Main
End Class 'Sample
[C#]
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
// Create the XmlDocument.
XmlDocument doc = new XmlDocument();
// Create a document fragment.
XmlDocumentFragment docFrag = doc.CreateDocumentFragment();
// Set the contents of the document fragment.
docFrag.InnerXml ="<item>widget</item>";
// Display the document fragment.
Console.WriteLine(docFrag.InnerXml);
}
}
[C++]
#using <mscorlib.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
// Create the XmlDocument.
XmlDocument* doc = new XmlDocument();
// Create a document fragment.
XmlDocumentFragment* docFrag = doc->CreateDocumentFragment();
// Set the contents of the document fragment.
docFrag->InnerXml =S"<item>widget</item>";
// Display the document fragment.
Console::WriteLine(docFrag->InnerXml);
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
XmlDocumentFragment クラス | XmlDocumentFragment メンバ | System.Xml 名前空間