XmlDocumentFragment.InnerXml Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Property Value
The markup of the children of this node.
Exceptions
The XML specified when setting this property is not well-formed.
Examples
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
Remarks
Setting this property replaces the children of the node with the parsed contents of the given string. The parsing is done in the current namespace context.
This property is a Microsoft extension to the Document Object Model (DOM).
Applies to
Зворотний зв’язок
https://aka.ms/ContentUserFeedback.
Очікується незабаром: протягом 2024 року ми будемо припиняти використання механізму реєстрації проблем у GitHub для зворотного зв’язку щодо вмісту й замінювати його новою системою зворотного зв’язку. Докладніше:Надіслати й переглянути відгук про