Search code examples
xmlweb.xmlxmlstarlet

select xml element from web.xml using xmlstarlet


I'm using xmlstarlet to select values from web.xml. It is not working and returns nothing. If my web.xml contains following properties:

<web-app version="2.4"
   xmlns="java.sun.com/xml/ns/j2ee"
   xmlns:xsi="w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="java.sun.com/xml/ns/j2ee java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

command I'm executing

xml select -t -v "web-app/display-name" web.xml 

How can i ignore above ?


Solution

  • I used the following and succeeded

    xml sel -N x="http://java.sun.com/xml/ns/j2ee" -t  -v "x:web-app/x:security-role" /root/WEB-INF/web.xml