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 the above command is adding two sub nodes named appuser
because of twice occurence of "web-app/security-constraint/auth-constraint"in my xml. I want to only add one . How can i do this?
You could make your xpath only match the first security-constraint element:
//x:web-app/x:security-constraint[1]/x:auth-constraint