> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/xml/xmlparse.md).

# XMLParse

Return new array

## Method Signature

```
XMLParse(XML=[string], caseSensitive=[boolean], validator=[any], lenient=[boolean])
```

### Arguments

| Argument        | Type      | Required | Description                                                                                                                                                 | Default |
| --------------- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `XML`           | `string`  | `false`  | The XML string to parse.                                                                                                                                    |         |
| `caseSensitive` | `boolean` | `false`  | Whether the XML parsing should be case-sensitive.                                                                                                           | `true`  |
| `validator`     | `any`     | `false`  | An optional validator to apply to the parsed XML. This can be a string containing a path or URL to an XSD schema file, or a struct of XML security settings |         |
| `lenient`       | `boolean` | `false`  | Whether the XML parsing should be lenient.                                                                                                                  |         |

## Examples

### Parse XML read from a file

Read XML from a file and use the xmlParse method to parse it into an XML data structure.

```java
<bx:file action="read" file="#tempxml#" variable="xmlString">
<bx:set myXML = xmlParse( xmlString ) >
```

### Additional Examples

[Run Example](https://try.boxlang.io/?code=eJxFjrEOwiAURXe%2B4qVTu8gHFEl0cjRObobKtSXhFQWatH9vgyG%2B6byTO5yV%2FSPlCMN0pEbQfmoOGbrg%2FuSgT949oeROVb5iYH0Og5KFqp5grJtHfQO72SIqWU1dDMFu%2BoIIconyBGKkZEbQFhaK%2BCxIGfagZBn%2BcmTtaXphF363dGd%2FNTGhpfWf31HXiy%2FEgj49)

```java
xml_stream = "
    <note>
      <to>Alice</to>
      <from>Bob</from>
      <heading>Reminder</heading>
      <body>Here is the message you requested.</body>
    </note>
  ";
dump( XmlParse( xml_stream ) );

```

## Related

* [XMLChildPos](/boxlang-language/reference/built-in-functions/xml/xmlchildpos.md)
* [XMLElemNew](/boxlang-language/reference/built-in-functions/xml/xmlelemnew.md)
* [XMLFormat](/boxlang-language/reference/built-in-functions/xml/xmlformat.md)
* [XMLGetNodeType](/boxlang-language/reference/built-in-functions/xml/xmlgetnodetype.md)
* [XMLNew](/boxlang-language/reference/built-in-functions/xml/xmlnew.md)
* [XMLSearch](/boxlang-language/reference/built-in-functions/xml/xmlsearch.md)
* [XMLTransform](/boxlang-language/reference/built-in-functions/xml/xmltransform.md)
* [XMLValidate](/boxlang-language/reference/built-in-functions/xml/xmlvalidate.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/xml/xmlparse.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
