Problem Statement
I'm looking at an XML file (the config file for PHPUnit), which has a couple elements with a lot of attributes. For example:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="test.bootstrap.inc.php" backupGlobals="false" colors="true" cacheDirectory="../build/.phpunit.cache" backupStaticProperties="false" requireCoverageMetadata="true" displayDetailsOnTestsThatTriggerDeprecations="true" displayDetailsOnTestsThatTriggerErrors="true" displayDetailsOnTestsThatTriggerNotices="true" displayDetailsOnTestsThatTriggerWarnings="true" displayDetailsOnPhpunitDeprecations="true">
<testsuites>
<testsuite name="Halo">
<directory>../src/Lunr/Halo/Tests/</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<clover outputFile="../build/logs/clover.xml"/>
<html outputDirectory="../build/coverage" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
<logging>
<junit outputFile="../build/logs/junit.xml"/>
</logging>
<source>
<include>
<directory>../src/Lunr/</directory>
</include>
<exclude>
<directory>../src/Lunr/Halo/Tests/</directory>
</exclude>
</source>
</phpunit>
This is the output I currently get when pretty printing it with xq and indentation of 4. However, the amount of attributes makes the root element pretty difficult to read, which is why we always put one attribute per line (which also makes it more VCS friendly), something like this:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="test.bootstrap.inc.php"
backupGlobals="false"
colors="true"
cacheDirectory="../build/.phpunit.cache"
backupStaticProperties="false"
requireCoverageMetadata="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnPhpunitDeprecations="true"
>
<testsuites>
<testsuite name="Halo">
<directory>../src/Lunr/Halo/Tests/</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<clover outputFile="../build/logs/clover.xml"/>
<html outputDirectory="../build/coverage" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
<logging>
<junit outputFile="../build/logs/junit.xml"/>
</logging>
<source>
<include>
<directory>../src/Lunr/</directory>
</include>
<exclude>
<directory>../src/Lunr/Halo/Tests/</directory>
</exclude>
</source>
</phpunit>
Expected Result
It would be nice if xq had a cli parameter that would allow controlling the formatting of attributes. Perhaps combined with a minimum amount of attributes so that elements with only 2 or 3 could still be kept on one line.
Problem Statement
I'm looking at an XML file (the config file for PHPUnit), which has a couple elements with a lot of attributes. For example:
This is the output I currently get when pretty printing it with
xqand indentation of 4. However, the amount of attributes makes the root element pretty difficult to read, which is why we always put one attribute per line (which also makes it more VCS friendly), something like this:Expected Result
It would be nice if
xqhad a cli parameter that would allow controlling the formatting of attributes. Perhaps combined with a minimum amount of attributes so that elements with only 2 or 3 could still be kept on one line.