---
title: "extract xml()"
slug: "xml-extract"
updated: 2026-08-17T13:04:35Z
published: 2026-08-17T13:04:35Z
canonical: "docs.lobstersoftware.com/xml-extract"
---
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.
# extract xml()
This function can extract a part from an XML file **a**, which is defined by the XPath expression **b**.
If more than one element is supplied by the XPath expression, only the first element is used.
## Parameters
| Parameter | Description |
| --- | --- |
| a | Name of the XML DOM object or XML as text. If no DOM object is found, the parameter value is interpreted as text. |
| b | The XPath expression. |
| c | (optional) If "true", errors are ignored. Default: "false". |
| d | (optional) If "true", the XML declaration in the result XML is omitted. Default: "false". |
| e | (optional) Name of the map for the namespace management. See examples for function [get value from XML()](/v1/docs/en/xml-get-value). |
## Example
Let's assume the following XML file, which you specify in parameter **a** either directly or via the DOM object you previously read in using function [parse XML()](/v1/docs/en/xml-parse-xml).
```xml