1

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 &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;"
    prefix="autolex."
    suffix=".log"/>
  <ResourceLink global="pendb"
      name="jdbc/DataSource"
      type="javax.sql.DataSource"/>
  <WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

2 Answers 2

2

You need to select the attribute:

/Context/@path

Your original query, /Context[@path] selects Context elements with a path attribute.

Sign up to request clarification or add additional context in comments.

Comments

1

This should work: /Context/@path

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.