XmlDocumentFragment.InnerXml Propriedade

Definição

Obtém ou define a marcação que representa os filhos deste nó.Gets or sets the markup representing the children of this node.

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

Valor da propriedade

String

A marcação dos filhos deste nó.The markup of the children of this node.

Exceções

O XML especificado ao definir essa propriedade não está bem formado.The XML specified when setting this property is not well-formed.

Exemplos

O exemplo a seguir usa a propriedade InnerXml para definir o conteúdo do fragmento do documento.The following example uses the InnerXml property to set the contents of the document fragment.

#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

Comentários

Definir essa propriedade substitui os filhos do nó pelo conteúdo analisado da cadeia de caracteres fornecida.Setting this property replaces the children of the node with the parsed contents of the given string. A análise é feita no contexto do namespace atual.The parsing is done in the current namespace context.

Essa propriedade é uma extensão da Microsoft do DOM (Modelo de Objeto do Documento).This property is a Microsoft extension to the Document Object Model (DOM).

Aplica-se a