I would like to smart indent my apache2 virtual host conf files. I found here how to smart indent xml files. But virtual host conf files are not valid xml files.
For instance if I try using xmllint on the 000-default.conf which is given in the apache2 repository, I get an error :
$ cat 000-default.conf | xmllint --format -
-:1: parser error : error parsing attribute name
<VirtualHost *:80>
^
-:1: parser error : attributes construct error
<VirtualHost *:80>
^
-:1: parser error : Couldn't find end of Start Tag VirtualHost line 1
<VirtualHost *:80>
^
-:1: parser error : Extra content at the end of the document
<VirtualHost *:80>
^
Does any one have a clue on how to handle this ?
As you say, apache2 config files are not XML files. xmllint
is a program to (inter alia) reformat XML files. It will not work on apache2 config files. Therefore, do not use xmllint
on apache2 config files, and you will avoid the errors you highlight above.
You would be better using an editor (see here for emacs apache2 mode), or a program written for reformatting apache2 config files.