Versuch dies zu tun:
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
xmllint --format -
Dieses Dienstprogramm kommt mit libxml2-utils
oder
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
xml_pp
Dieser Befehl ist mit XML::Twigperl Modul, manchmal xml-twig-tools
Paket.
oder
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
xmlstarlet format --indent-tab
Dieser Befehl ist mit xmlstarlet
oder
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
tidy -xml -i -
Scheck tidy
Paket
oder
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
python -c 'import sys;import xml.dom.minidom;s=sys.stdin.read();print xml.dom.minidom.parseString(s).toprettyxml()'
oder
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
saxon-lint --indent --xpath '/' -
Scheck saxon-lint
oder
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
java -cp /usr/share/java/saxon/saxon9he.jar net.sf.saxon.Query \
-s:- -qs:/ '!indent=yes'
prüfen saxon-HE
Gute, schnelle Antwort. Die erste Option scheint zu sein, dass sie auf modernen * nix-Installationen allgegenwärtiger sein wird. Ein kleiner Punkt; aber kann es ohne Durcharbeitung einer Zwischendatei aufgerufen werden? I.e., echo ' ' | xmllint --some-read-from-stdn-option'? –
svidgen
Siehe meinen bearbeiteten Post –
Das Paket ist 'libxml2-utils' in meinem schönen ubuntu. – franzlorenzon