> For the complete documentation index, see [llms.txt](https://docs.appmixer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appmixer.com/connector-configuration/utils/xml/validatexml.md).

# Validate XML

### Overview

The **XML Validation Component** verifies whether an input XML string is well-formed and conforms to certain validation rules. It supports options for boolean attributes and unpaired tags, ensuring that the XML structure meets expected standards.

### Usage

This component takes an XML string as input and checks for syntax errors, invalid structures, and unsupported tags. If the XML is valid, it outputs a confirmation; otherwise, it returns error details.

#### Input Ports

| Port | Description                           |
| ---- | ------------------------------------- |
| `in` | Accepts an XML string for validation. |

**Input Properties**

| Property                 | Type      | Description                                                                   |
| ------------------------ | --------- | ----------------------------------------------------------------------------- |
| `xml`                    | `string`  | XML content to validate.                                                      |
| `allowBooleanAttributes` | `boolean` | If `true`, allows boolean attributes (e.g., `<input checked>`).               |
| `unpairedTags`           | `string`  | Comma-separated list of tags that don't require closing pairs (e.g., `<br>`). |

#### Output Ports

| Port  | Description                  |
| ----- | ---------------------------- |
| `out` | Provides validation results. |

**Output Properties**

| Property   | Type      | Description                                |
| ---------- | --------- | ------------------------------------------ |
| `isValid`  | `boolean` | `true` if XML is valid, `false` otherwise. |
| `err.code` | `string`  | Error code if XML is invalid.              |
| `err.msg`  | `string`  | Error message detailing the issue.         |
| `err.line` | `number`  | Line number where the error occurred.      |
| `err.col`  | `number`  | Column number where the error occurred.    |

#### Processing Logic

1. **Parse XML Input**: Accepts an XML string and applies validation rules.
2. **Apply Boolean Attribute Handling**: Determines whether attributes can be boolean.
3. **Check Unpaired Tags**: Validates unpaired tags against the provided list.
4. **Return Validation Result**: If valid, sends `isValid: true`; if invalid, returns an error with details.

### Notes

* **Boolean Attribute Support**: Useful for HTML-like XML where some attributes don’t require values.
* **Custom Unpaired Tags**: Enables validation for tags that don’t have closing counterparts.
* **Detailed Error Reporting**: Helps identify structural issues with precise error messages and locations.

This component ensures XML correctness, aiding in proper document parsing and integration workflows.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.appmixer.com/connector-configuration/utils/xml/validatexml.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
