xpath expression evaluation does not work in 8.1.2

I have tried the following simple xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="MonitorServiceCache">


            <property name="eclipselink.jdbc.driver" value="org.h2.Driver"/>
            <property name="eclipselink.jdbc.url" value="jdbc:h2:mem:monitorServiceDB"/>
            <!-- I work in this example without user / password.-->
            <property name="eclipselink.jdbc.user" value="monitorServiceCache"/>
            <property name="eclipselink.jdbc.password" value=""/>

            <!-- EclipseLink should create the database schema automatically -->

            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
            <property name="eclipselink.ddl-generation.output-mode" value="database"/>
            <property name="eclipselink.target-database" value="HSQL"/> <!--Is this necessary???-->



and the following simple xpath expression fails:



Comment actions Permalink

Hello Saqib,

and the following simple xpath expression fails:



No, this is correct. There is no default namespace in XPath, so you need to configure a prefix, e.g.
"p" for the URI "http://java.sun.com/xml/ns/persistence" (switch to Advanced Mode, "Edit
Context...") and use it in your query like this:



Comment actions Permalink

Ah - that works! Thanks!

I figured there must have been something that I missed right after I submitted the question! :-\


Please sign in to leave a comment.