3.7.6 Indent an XML string: xml_print
The xml_print command formats an XML string.
-
xml_print takes one argument:
str, a string, assumed to contain XML.
- xml_print(str) returns a string with the XML code
indented for better readability. The default indentation is two spaces.
Example.
Input:
xml_print("<?xml version=’1.0’?><root><child1>some content</child1><child2></child2><child3/></root>")
Output:
<?xml version='1.0'?> |
<root> |
<child1>some content</child1> |
<child2></child2> |
<child3/> |
</root>
|