XPath Expression For Selecting All Children Nodes Without Decendents Java
<p>So I am using XPath in my Java application to parse an xml file. The file format is as follows:</p>

<pre><code>&lt;RootNode&gt;
    &lt;Node1&gt;Value 1&lt;/Node1&gt;
    &lt;Node2&gt;
        &lt;Node2-1&gt;
            &lt;Node2-1-1&gt;Value 2.1.1&lt;/Node2-1-1&gt;
        &lt;/Node2-1&gt;
    &lt;/Node2&gt;
    &lt;Node3&gt;Value 3&lt;/Node3&gt;
&lt;/RootNode&gt;
</code></pre>

<p>I am trying to grab only Node1 and Node3 in a general way. With the RootNode context, I have tried:</p>

<pre><code>child::[text()]
*/text()
*/node()
*
</code></pre>

<p>* gets me the closest but grabs Node2. How can get just single value nodes and ignore nodes with decedents?</p>