XmlDocumentFragment.InnerXml 属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置表示此节点子级的标记。
public:
 virtual property System::String ^ InnerXml { System::String ^ get(); void set(System::String ^ value); };public override string InnerXml { get; set; }member this.InnerXml : string with get, setPublic Overrides Property InnerXml As String属性值
此节点子级的标记。
例外
设置此属性时指定的 XML 格式不正确。
示例
以下示例使用 InnerXml 属性设置文档片段的内容。
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   
   // Create the XmlDocument.
   XmlDocument^ doc = gcnew 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 );
}
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);
  }
}
Option Explicit
Option Strict
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
End Class
注解
设置此属性会将节点的子级替换为给定字符串的已分析内容。 分析在当前命名空间上下文中完成。
此属性是文档对象模型 (DOM) 的 Microsoft 扩展。