System.Xml.XmlDataDocument.CreateElement Method

Creates an element with the specified XmlNode.Prefix, XmlDocument.LocalName , and XmlNode.NamespaceURI.

Syntax

public override XmlElement CreateElement (string prefix, string localName, string namespaceURI)

Parameters

prefix
The prefix of the new element. If String.Empty or null, there is no prefix.
localName
The local name of the new element.
namespaceURI
The namespace Uniform Resource Identifier (URI) of the new element. If String.Empty or null, there is no namespaceURI.

Returns

A new System.Xml.XmlElement.

Remarks

Note to Inheritors If you overload this function, it cannot be used for extensibility. Instead, you can return an element created by the base class, in this case, XmlDataDocument. See the following example.

Example

 class MyXmlDataDocument : XmlDataDocument {
  public override XmlElement CreateElement(string prefix, string localName, string nsURI) {
    //Ensure we are returning the base class implementation of element.
    XmlElement e = base.CreateElement(prefix, localName, nsURI);
    //Add additional code here.
    return e;    //Return the element created by XmlDataDocument.
  }    
 }

Requirements

Namespace: System.Xml
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0