XmlDocumentFragment.InnerXml Proprietà

Definizione

Ottiene o imposta il markup che rappresenta gli elementi figlio di questo nodo.

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, set
Public Overrides Property InnerXml As String

Valore della proprietà

Markup degli elementi figlio di questo nodo.

Eccezioni

Il codice XML specificato durante l'impostazione di questa proprietà non è ben formato.

Esempio

Nell'esempio seguente viene utilizzata la proprietà InnerXml per impostare il contenuto del frammento di documento.

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

Commenti

L'impostazione di questa proprietà sostituisce gli elementi figlio del nodo con il contenuto analizzato della stringa specificata. L'analisi viene eseguita nel contesto dello spazio dei nomi corrente.

Questa proprietà è un'estensione Microsoft per il DOM (Document Object Model).

Si applica a