I have an XML object that I'm exporting to a string like so:
var xml:XML = new XML(myString);
trace(xml.toXMLString());
This results in something like:
<root>
<item>
<item>
<item/>
</item>
</item>
</root>
However, the indentations are much to short in my opinion especially with a lot of content and it's hard to read. Irregardless of the reasons is there a way to increase the indentations like maybe to use tabs or more tabs instead of spaces? Not sure what it's using (will check). I would like it to look closer to this. It looks much cooler too.
<root>
<item>
<item>
<item/>
</item>
</item>
</root>
UPDATE:
I found the XML.prettyPrint setting and turned it on (set to true). It didn't work how I expected and indented and spaced out the line height.
Here it is before:
Here it is after:
I'm turning pretty print off.
The XML class has static properties that control the formatting output.
XML.prettyIndent = 4;
trace(xml)
Also, I'm not sure why they made these settings static, but to avoid tampering with settings that might affect code elsewhere you can read the current settings using XML.settings()
then restore them after you are done using XML.setSettings()
.