## Syntax ```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)) ``` ## Purpose The `XMLFORMAT` SQL function pretty-prints xml text. See also [[XMLCOMMENT]], [[XMLDECODE]], [[XMLELEMENT]], [[XMLENCODE]] and [[XMLTRANSFORM]]. Parameters: - Xml (`varchar2`): xml to pretty-print. Returns: the pretty-printed XML text. ## Examples The following example pretty-prints a compact XML text: ```sql select xmlformat('<r><name>peter</name></r>') ------------------- <?xml version="1.0" encoding="utf-8"?> <r> <name>peter</name> </r> ``` The following example raises an error since the XML text is invalid; the end tag `c` does not match the start tag `a`: ```sql select xmlformat('<root><a>b</c></root>') itgenxml120: XML formatting failed. ```