---
title: "XMLFORMAT"
description: "La fonction SQL XMLFORMAT met en forme le texte XML avec une indentation lisible."
language: fr
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/fr/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/fr/
---

## Syntaxe
```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))
```

## Objet
La fonction SQL `XMLFORMAT` permet de mettre en forme le texte XML.

Voir aussi [[XMLCOMMENT]], [[XMLDECODE]], [[XMLELEMENT]], [[XMLENCODE]] et [[XMLTRANSFORM]].

Paramètres :
- XML (`varchar2`) : code XML à mettre en forme.

Renvoie : le texte XML formaté de manière lisible.

## Exemples
L'exemple suivant formate de manière lisible un texte XML concis :
```sql
select xmlformat('<r><name>peter</name></r>')

-------------------
<?xml version="1.0" encoding="utf-8"?>
<r>
  <name>peter</name>
</r>
```
L'exemple suivant génère une erreur car le texte XML n'est pas valide ; la balise de fermeture `c` ne correspond pas à la balise d'ouverture `a` :
```sql
select xmlformat('<root><a>b</c></root>')

itgenxml120: XML formatting failed.
```

