Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add an attribute using xmllint

Tags:

xml

xmllint

I want to add an attribute to the tag, using xmllint. Can I do this is through xmllint?

like image 668
Rusty Robot Avatar asked Jun 19 '11 18:06

Rusty Robot


1 Answers

Xmllint in not made to edit XML, so I think the answer is “no, you can't”.

To edit XML, you can use XMLStarlet, the syntax to add an attribute into existing XML document is:

xmlstarlet ed -L -i xpath -t attr -n name -v value file

like image 79
svick Avatar answered Nov 15 '22 22:11

svick