# TextControl.XmlNotWellFormed Event

> Occurs when a loaded XML document is not well-formed. The event handler receives an argument of type XmlErrorEventArgs containing data related to this event.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Event
- **Introduced:** 16.0
- **Namespace:** `TXTextControl.WPF`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.WPF.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.WPF.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl.WPF > TextControl.XmlNotWellFormed Event
- **318 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/xmlnotwellformed-event/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/xmlnotwellformed-event/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/xmlnotwellformed-event/llms-full.txt

---

### Description

Occurs when a loaded XML document is not well-formed. The event handler receives an argument of type [XmlErrorEventArgs](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/xmlerroreventargs/llms-full.txt) containing data related to this event.

### Syntax

```csharp
public event XmlErrorEventHandler XmlNotWellFormed;
```

```vbnet
Public Event XmlNotWellFormed As XmlErrorEventHandler
```

### Examples

The following example records useful context when xml not well formed occurs.

```csharp
textControl.XmlNotWellFormed += (sender, e) =>
{
    Console.WriteLine($"File Position: {e.FilePosition}");
};
```

```vbnet
AddHandler textControl.XmlNotWellFormed,
    Sub(sender, e)
        Console.WriteLine($"File Position: {e.FilePosition}")
    End Sub
```

---

## Nearby

- **Previous:** [TextControl.XmlInvalid Event](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/xmlinvalid-event/llms-full.txt)
- **Next:** [TextControl.Zoom Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/zoom-method/llms-full.txt)
