InnerXml Property

XmlDocumentFragment.InnerXml Property


Gets or sets the markup representing the children of this node.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public override string InnerXml { get; set; }

Property Value

Type: System.String

The markup of the children of this node.

Exception Condition

The XML specified when setting this property is not well-formed.

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).

The following example uses the InnerXml property to set the contents of the document fragment.

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.


Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft