# XmlElement Class

> An instance of this class represents an element in a XML document. To iterate through all occurrences of an XML element in a Text Control document the XmlElementCollection class can be used.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Class
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > XmlElement Class
- **814 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/llms-full.txt

---

### Description

An instance of this class represents an element in a XML document. To iterate through all occurrences of an XML element in a Text Control document the [XmlElementCollection](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelementcollection/llms-full.txt) class can be used.

### Syntax

```csharp
public class XmlElement
```

```vbnet
Public Class XmlElement
```

### Examples

The following example creates a Xml Element instance and configures its text setting for a document workflow.

```csharp
XmlElement xmlElement = new("CustomerName");
xmlElement.Text = "Quarterly results";
```

```vbnet
Dim xmlElement As New XmlElement("CustomerName")
xmlElement.Text = "Quarterly results"
```

---

## In This Section

- [XmlElement.AddChild Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/addchild-method/llms-full.txt): Adds a new XML element as a sub-element of this element. The new element is placed at the position specified through the document's DTD.
- [XmlElement.AutoSelect Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/autoselect-property/llms-full.txt): Determines whether the text of a newly added XML element is automatically selected.
- [XmlElement.AutoText Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/autotext-property/llms-full.txt): Determines whether text is automatically created for a newly added XML element that has no text contents. The created text consists of the element's name enclosed in square brackets and is created only if no text has been set with the XML element's Text property.
- [XmlElement Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/constructor/llms-full.txt): Initializes a new instance of the XmlElement class.
- [XmlElement.ElementName Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/elementname-property/llms-full.txt): Gets the name of an XML element.
- [XmlElement.GetChildItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/getchilditem-method/llms-full.txt): Returns an XML Element object that represents a child element of this element.
- [XmlElement.RemoveChild Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/removechild-method/llms-full.txt): Removes an XML child element.
- [XmlElement.Select Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/select-method/llms-full.txt): Selects the text of the XML element. The text can only be selected, if the element belongs to the document.
- [XmlElement.Text Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/text-property/llms-full.txt): Specifies the text of the XML element. If the element consists of several sub-elements, the text parts are separated through paragraph end characters (0x0A).

---

## Nearby

- **Previous:** [VersionInfo.ServicePack Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/versioninfo/servicepack-property/llms-full.txt)
- **Next:** [XmlElement.AddChild Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/xmlelement/addchild-method/llms-full.txt)
