pretty print

I've got pretty print much closer, but I haven't yet been able to produce it with a starting indent level.  The alternative is to run the file xml output through the pretty printer before writing the file.
This commit is contained in:
Michael Richey 2017-12-03 11:47:48 -06:00 committed by GitHub
parent 8f3d573202
commit 07051d0955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -2334,7 +2334,11 @@ class Fields extends Structure
{
$dom = dom_import_simplexml($xml)->ownerDocument;
$dom->formatOutput = true;
return $dom->saveXML($dom->getElementsByTagName($nodename)->item(0));
$xmlString = $dom->saveXML($dom->getElementsByTagName($nodename)->item(0));
$tidy = new Tidy();
$tidy->parseString($xmlString,array('indent'=>true,'indent-spaces'=>8,'input-xml'=>true,'output-xml'=>true,'indent-attributes'=>true,'wrap-attributes'=>true,'wrap'=>false));
$tidy->cleanRepair();
return $tidy;
}
}