# Parse XML as schema
> Supported in: Batch, Streaming
Parses xml strings following the given schema definition, ignoring any fields not in the schema.
**Expression categories:** File, Struct
## Declared arguments
* **Input schema:** Schema definition used when parsing the xml strings.
*Type\*
* **Xml:** The xml string to parse.
*Expression\*
* *optional* **Attribute prefix:** Prefix for attributes on tags.
*Literal\*
* *optional* **Ignore namespace:** If set, ignores the namespace on elements and attributes. For example, \ would be treated as if it were just . Defaults to false.
*Literal\*
* *optional* **Output mode:** The 'simple' output mode will return null if an error is encountered during parsing (including those found as a result of invalid input). The 'with errors' output mode will return a parsable struct with any errors found during parsing in an 'errors' field and a valid parsed xml in the 'ok' field.
*Enum\*
* *optional* **Value tag:** The tag used for the value when there are attributes in the element having no child.
*Literal\*
**Output type:** *Struct*
## Examples
### Example 1: Base case
**Argument values:**
* **Input schema:** Struct\>
* **Xml:** `xml`
* **Attribute prefix:** *null*
* **Ignore namespace:** *null*
* **Output mode:** `SIMPLE`
* **Value tag:** *null*
| xml | **Output** |
| ----- | ----- |
| \
\XB-112\
\
\JFK\
\2000\
\
\ | {
**airport**: {
**id**: JFK,
**miles**: 2000,
},
**id**: XB-112,
} |
***
### Example 2: Base case
**Description:** When namespace is ignored, parsing ignores namespace in the data. Note that namespaces in the schema will never match a key since the namespace is filtered.
**Argument values:**
* **Input schema:** Struct\>
* **Xml:** `xml`
* **Attribute prefix:** \_
* **Ignore namespace:** true
* **Output mode:** `SIMPLE`
* **Value tag:** *null*
| xml | **Output** |
| ----- | ----- |
| \
\John Doe\
\john.doe@exampl... | {
**\_attribute**: tall,
**address**: {
**city**: Exampleville,
\*... |
***
### Example 3: Null case
**Description:** When a requested field is missing in the input XML the field becomes null.
**Argument values:**
* **Input schema:** Struct\>
* **Xml:** `xml`
* **Attribute prefix:** *null*
* **Ignore namespace:** *null*
* **Output mode:** `SIMPLE`
* **Value tag:** *null*
| xml | **Output** |
| ----- | ----- |
| \
\XB-112\
\
\JFK\
\
\ | {
**airport**: {
**id**: JFK,
**miles**: *null*,
},
**id**: XB-112,
} |
***
### Example 4: Null case
**Description:** When the requested schema is too small, only the fields in the schema are parsed.
**Argument values:**
* **Input schema:** Struct\
* **Xml:** `xml`
* **Attribute prefix:** \_
* **Ignore namespace:** *null*
* **Output mode:** `SIMPLE`
* **Value tag:** *null*
| xml | **Output** |
| ----- | ----- |
| \
\XB-112\
\
\JFK\
\
\ | {
**id**: XB-112,
} |
***
### Example 5: Null case
**Description:** You can read attributes by putting attribute prefix in front of the name.
**Argument values:**
* **Input schema:** Struct\>
* **Xml:** `xml`
* **Attribute prefix:** \_
* **Ignore namespace:** *null*
* **Output mode:** `SIMPLE`
* **Value tag:** *null*
| xml | **Output** |
| ----- | ----- |
| \ \XB-112\ \
\2000\
\
\ | {
**airport**: {
**\_id**: JFK,
**miles**: 2000,
},
**id**: XB-112,
} |
***