# Working With XML Files

> Open, validate, edit and program XML documents in TXTextControl with a CSS style sheet and a DTD: XML editor mode, XMLElements and the XML Basics sample.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control ActiveX > Document Editor > Working With XML Files
- **674 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/llms-full.txt

---

If your application edits structured data such as address lists, the XML features of TX Text Control Enterprise let users work on XML files in the word processor while a DTD keeps the structure valid. `TXTextControl` opens an XML file, displays it with the formatting of a CSS style sheet and gives your code access to every element.

The pages below start with a Visual Basic sample that opens an XML file together with its CSS style sheet and DTD, and go on to the properties and methods for loading, saving, editing and programming XML documents.

### How XML Documents Work in TX Text Control

- **Three files** describe an XML document: the XML file holds the data, the CSS file its formatting and the DTD, the document type definition, the elements it may contain and their order.
- **Loading** with the [Load](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/load-method/llms-full.txt) method validates the document against its DTD. A valid document is opened in the XML editor mode, which keeps it valid while it is edited.
- **Your code** reaches the elements through the [XMLElements](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/xmlelements-property/llms-full.txt) property and the [XMLElement](https://docs.textcontrol.com/tx-text-control-activex/reference/xmlelement/llms-full.txt) object.

### Find the Right Page

| If you want to | Read |
|---|---|
| See how an XML file, its CSS file and its DTD work together | [XML Basics](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/basics/llms-full.txt) |
| Open the sample program of this section and load an XML file | [XML Basics](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/basics/#open-an-xml-file-in-the-sample-program) |
| Handle invalid or not well-formed documents and save the CSS file | [Loading and Saving XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/load-save/llms-full.txt) |
| Know what users can do in the XML editor mode | [Editing XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/editing/llms-full.txt) |
| Read and change elements in code | [Programming XML Documents](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/programming/llms-full.txt) |
| Insert and delete elements in code | [Programming XML Documents](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/programming/#insert-an-element) |

### Where to Start

1. Run the XML Basics sample from the *Samples\\vb6\\XMLBasics* sample source directory and read [XML Basics](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/basics/llms-full.txt) alongside it.
2. Read [Loading and Saving XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/load-save/llms-full.txt) for what happens when a document doesn't match its DTD.
3. Continue with [Editing XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/editing/llms-full.txt) and [Programming XML Documents](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/programming/llms-full.txt).

### Pages in This Section

- [Loading and Saving XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/load-save/llms-full.txt): validation, load errors and saving the CSS file.
- [Editing XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/editing/llms-full.txt): the XML editor mode, formatting styles and the XML combo boxes.
- [Programming XML Documents](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/programming/llms-full.txt): reading, setting, inserting and deleting elements.
- [XML Basics](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/basics/llms-full.txt): the sample program with its XML file, CSS file and DTD.

---

## In This Section

- [XML Basics](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/basics/llms-full.txt): Walk through the XML Basics sample for Visual Basic: load an XML file with Load format 10, format it with a CSS style sheet and validate it with a DTD.
- [Editing XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/editing/llms-full.txt): Edit XML documents in the XML editor mode of TXTextControl: element selections, the TAB key, style-based formatting and the button bar XML combo boxes.
- [Loading and Saving XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/load-save/llms-full.txt): Load and save XML with the Load and Save methods: DTD validation, XMLInvalid and XMLNotWellFormed events, CSS formatting styles and the XML editor mode.
- [Programming XML Documents](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/programming/llms-full.txt): Get, set, iterate, insert and delete XML elements in Visual Basic with the XMLElements collection, XMLElement.Text, Add and Remove under the rules of a DTD.

---

## Nearby

- **Previous:** [Using Microsoft Word Fields](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/microsoft-word/llms-full.txt)
- **Next:** [Loading and Saving XML Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/xml/load-save/llms-full.txt)
