Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30946 > unrolled thread

XPath problem

Started byCaptain Obvious <mr.happeee@gmail.com>
First post2015-01-28 09:57 -0800
Last post2015-01-28 10:12 -0800
Articles 2 — 1 participant

Back to article view | Back to comp.lang.java.programmer


Contents

  XPath problem Captain Obvious <mr.happeee@gmail.com> - 2015-01-28 09:57 -0800
    Re: XPath problem Captain Obvious <mr.happeee@gmail.com> - 2015-01-28 10:12 -0800

#30946 — XPath problem

FromCaptain Obvious <mr.happeee@gmail.com>
Date2015-01-28 09:57 -0800
SubjectXPath problem
Message-ID<77ecdbc0-4d08-4bc1-a409-5eb546352356@googlegroups.com>
Trying to debug something in the course of standing up some legacy code on a new server, would appreciate any comments: The code I am working with uses dom4j-1.6.1.jar with JRE 1.5.0_22. For some reason all attempts to execute

DocumentHelper.createXPath("//property");

result in this error:

[28-Jan-2015 12:31:27.335] DEBUG - Message: Invalid XPath expression: '//property'. Caused by: org.jaxen.dom4j.DocumentNavigator.getInstance()Lorg/jaxen/Navigator;
org.dom4j.InvalidXPathException: Invalid XPath expression: '//property'. Caused by: org.jaxen.dom4j.DocumentNavigator.getInstance()Lorg/jaxen/Navigator;

A few things I have determined while looking into this:

 - The legacy argument to createXPath was createXPath("/config/property");

 - The xml file I am working with contains many <property> blocks: <control><property>[stuff]</property>{followed by many more property blocks}</control>

 - Have tried many variations of what appear to be valid arguments to createXPath(): "/config/property", "//config/property", "/property", "//property" and others all to no avail.

If anyone could offer some insight into what is wrong with my call to createXPath, or my environment, or how one might debug this problem, that would be great.

Thanks,
-jt

Below is a portion of the java source I am working with. This code is working as expected in the customer's production environment:

//java packages
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

//packages from dom4j-1.6.1.jar
import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.XPath;
import org.dom4j.io.SAXReader;
.
.
.
XPath xpathSelector = DocumentHelper.createXPath("/config/property");

[toc] | [next] | [standalone]


#30947

FromCaptain Obvious <mr.happeee@gmail.com>
Date2015-01-28 10:12 -0800
Message-ID<c9bd5d41-1825-48bd-908c-95c9966d7efd@googlegroups.com>
In reply to#30946
To clarify a bit: The "Invalid XPath expression" error messahe inludes whatever value I pass to createXPath(). Not always '//property' as above.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web