Reputation: 6755
How can I extract the value autolex from this xml with xpath? Currently I am trying it with this xpath expression /Context[@path]
but it returns the complete element.
I need only the value autolex
<?xml version="1.0" encoding="UTF-8"?>
<!-- neue Version des context.xml zum Deployment ausserhalb des Tomcat webapps-verzeichnis -->
<Context path="/autolex"
docBase="../../../applications/srs-autolex-1.1.1-0.war"
clearReferencesStatic="true"
unpackWAR="false"
reloadable="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
fileDateFormat="yyyy-MM-dd"
pattern="%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i""
prefix="autolex."
suffix=".log"/>
<ResourceLink global="pendb"
name="jdbc/DataSource"
type="javax.sql.DataSource"/>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
Upvotes: 1
Views: 141
Reputation: 38247
You need to select the attribute:
/Context/@path
Your original query, /Context[@path]
selects Context
elements with a path
attribute.
Upvotes: 2