# XMLInvalid Event

> Occurs when a loaded XML document cannot be validated with its DTD; passes the file position, OLE status code and description, and can cancel the message.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Event
- **Path:** TX Text Control ActiveX > API Reference > TXTextControl > XMLInvalid Event
- **263 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/xmlinvalid-event/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/xmlinvalid-event/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/xmlinvalid-event/llms-full.txt

---

Occurs when a loaded XML document cannot be validated with the document type definition (DTD) referenced in the document. The document's contents are loaded but the document itself cannot be handled or saved as XML document.

### Syntax

```vbscript
XMLInvalid(FilePos, Scode, Description, CancelDisplay)
```

### Parameters

| Parameter | Description |
|---|---|
| FilePos | Is the absolute file position where the error occurred. |
| Scode | Is the OLE Status Code. |
| Description | Explains the reason for the error. This string can be changed. |
| CancelDisplay | Can be set to True if the application wants to display its own error string. When this parameter is not set to True, the control will display a message box showing an error string. |

### Data Types

| Name | Data type |
|---|---|
| FilePos | Long |
| Scode | Long |
| Description | String |
| CancelDisplay | Boolean |

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

---

## Nearby

- **Previous:** [XMLElements Property](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/xmlelements-property/llms-full.txt)
- **Next:** [XMLNotWellFormed Event](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/xmlnotwellformed-event/llms-full.txt)
