This documentation is archived and is not being maintained.

XmlDataDocument.CreateElement Method (String, String, String)

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

Namespace: System.Xml
Assembly: System.Data (in

public override XmlElement CreateElement (
	string prefix,
	string localName,
	string namespaceURI
public XmlElement CreateElement (
	String prefix, 
	String localName, 
	String namespaceURI
public override function CreateElement (
	prefix : String, 
	localName : String, 
	namespaceURI : String
) : XmlElement



The prefix of the new element If String.Empty or a null reference (Nothing in Visual Basic), there is no prefix.


The local name of the new element.


The namespace Uniform Resource Identifier (URI) of the new element. If String.Empty or a null reference (Nothing in Visual Basic), there is no namespaceURI.

Return Value

A new XmlElement.

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.

 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.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0