# XMLElement Object

> XMLElement OLE Automation object for an element of an XML document, created with CreateObject: ElementName, Text, AddChild, ChildItem, RemoveChild and Select.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Object
- **Path:** TX Text Control ActiveX > API Reference > XMLElement Object
- **459 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/llms-full.txt

---

An XMLElement object is an OLE Automation object that represents an element in an XML document. To iterate through all existing XML elements the [XMLElements](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelements/llms-full.txt) collection object can be used. An XMLElement object has the following class name that can be used to create a new object with the **CreateObject** function:

TIS.TX.XMLElement.34

### Syntax

```vbscript
XMLElement
```

### Members

#### Properties

| Property | Description |
|---|---|
| [AutoSelect](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/autoselect-property/llms-full.txt) | Determines whether the text of a newly added XML element is automatically selected. |
| [AutoText](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/autotext-property/llms-full.txt) | Determines whether text is automatically created for a newly added XML element that has no text contents. |
| [ElementName](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/elementname-property/llms-full.txt) | Returns or sets the XML element's name. |
| [Text](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/text-property/llms-full.txt) | Returns or sets the text belonging to an XML element. |

#### Methods

| Method | Description |
|---|---|
| [AddChild](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/addchild-method/llms-full.txt) | Adds a new [XMLElement](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/llms-full.txt) object as a sub-element of this element. |
| [ChildItem](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/childitem-method/llms-full.txt) | Returns an [XMLElement](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/llms-full.txt) object that is a child element of this element. |
| [RemoveChild](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/removechild-method/llms-full.txt) | Removes a sub-element from this element. |
| [Select](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/select-method/llms-full.txt) | Selects the text of the XML element. |

### See Also

- [Working with XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/llms-full.txt)
- [Programming Category: XML Programming](https://docs.textcontrol.com/tx-text-control-activex/reference/categories/xml/llms-full.txt)

---

## In This Section

- [AddChild Method](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/addchild-method/llms-full.txt): Adds an XMLElement as a sub-element at the position the DTD gives, optionally before or after a child; returns 0 on error, 1 if invalid, 2 on success.
- [AutoSelect Property](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/autoselect-property/llms-full.txt): Determines whether the text of a newly added XML element is selected automatically; the Boolean AutoSelect property is True by default. Run time only.
- [AutoText Property](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/autotext-property/llms-full.txt): Determines whether a new XML element without text gets its name in square brackets as text; the Boolean AutoText property is True by default. Run time only.
- [ChildItem Method](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/childitem-method/llms-full.txt): Returns the child XMLElement with the given element name, with an optional Index for elements with several sub-elements of that name, and a Basic example.
- [ElementName Property](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/elementname-property/llms-full.txt): Returns or sets the name of an XMLElement as a String; the name can only be changed for newly created elements, not for elements of an XML document.
- [RemoveChild Method](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/removechild-method/llms-full.txt): Removes a sub-element by name and optional Index from an XMLElement; returns 0 on error, 1 if the DTD makes the document invalid, 2 on success.
- [Select Method](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/select-method/llms-full.txt): Selects the text of an XML element that belongs to the document; for an element with several sub-elements, the text of the first sub-element is selected.
- [Text Property](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/text-property/llms-full.txt): Returns or sets the text of an XML element, the default property of XMLElement; the text parts of several sub-elements are separated with linefeeds, Chr(10).

---

## Nearby

- **Previous:** [Item Method](https://docs.textcontrol.com/tx-text-control-activex/reference/styles/item-method/llms-full.txt)
- **Next:** [AddChild Method](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/addchild-method/llms-full.txt)
