xmllint: Remove <?xml version="1.0"?>
Asked Answered
D

1

9

I am using xmllint to clean up my .xml file but for some reason the output adds <?xml version="1.0"?> to the first line. Is there a flag to have this be removed?

Durra answered 5/5, 2015 at 17:25 Comment(6)
I guess, you are aware, that that line is actually required for the XML file to be a valid XML file?Parliamentary
I know it is a strange request but the files I am dealing with do not have it but they are valid xml otherwise. I wanted to stay consistent and not have the xml version.Durra
people should be a bit more conservative with their down-votes, this question is fine. +1Caprifoliaceous
Use regex to remove it afterwards?Halfback
Pipe it through tail -n +2 to remove the first line...Inaccuracy
@Hristo-Iliev That line is not required.Crassulaceous
L
4

Both of the following seem to avoid insertion of <?xml version="1.0"?>:

  • xmllint --exc-c14n data.xml

  • xmllint --c14n data.xml

Hint:

xmllint --help

-or-

man xmllint

Lalalalage answered 5/5, 2015 at 17:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.