xml - Adding only one subnode using xmlstarlet -


giving command

xml ed -n x=http://java.sun.com/xml/ns/j2ee -s //x:web-app/x:security-constraint/x:auth-constraint -t elem -n role-name -v appuser web-inf/web.xml 

but above command adding 2 sub nodes named appuser because of twice occurence of "web-app/security-constraint/auth-constraint"in xml. want add 1 . how can this?

you make xpath match first security-constraint element:

//x:web-app/x:security-constraint[1]/x:auth-constraint 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -