---
title: "XMLFORMAT"
description: "La funzione SQL XMLFORMAT formatta in modo leggibile il testo XML."
language: it
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/it/docs/invantive-universalsql/grammar/sql-functions/xmlformat
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/xmlformat
updated: 2026-12-04T14:56:12Z
license: https://documentation.invantive.eu/it/
---

## Sintassi
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> XMLFORMAT[XMLFORMAT]:::quoted
    XMLFORMAT --> End((END))
```

## Scopo
La funzione SQL `XMLFORMAT` formatta in modo leggibile il testo XML.

Vedi anche [[XMLCOMMENT]], [[XMLDECODE]], [[XMLELEMENT]], [[XMLENCODE]] e [[XMLTRANSFORM]].

Parametri:
- XML (`varchar2`): codice XML da formattare in modo leggibile.

Restituisce: il testo XML formattato in modo leggibile.

## Esempi
L'esempio seguente formatta in modo leggibile un testo XML compatto:
```sql
select xmlformat('<r><name>peter</name></r>')

-------------------
<?xml version="1.0" encoding="utf-8"?>
<r>
  <name>peter</name>
</r>
```
L'esempio seguente genera un errore poiché il testo XML non è valido; il tag di chiusura `c` non corrisponde al tag di apertura `a`:
```sql
select xmlformat('<root><a>b</c></root>')

itgenxml120: XML formatting failed.
```

