[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XPath selectNodes() returns empty List

xpath selectnodes

I'm having a problem and don't seem to be able to find the cause of it.  
Here are the details.

I'm processing the following xml file insided of a Java program using JDOM 1.0

<?xml version="1.0" encoding="UTF-8"?>
<!--<!DOCTYPE decision-process SYSTEM "decision-process.dtd">-->
	<decision type="primitive" id="fppLogic">
	<decision type="primitive" id="sellExists">
	<decision type="primitive" id="outstanding">
	<decision type="composite" id="outstandingComposite">
		<!--<decision type="primitive" name="sellExists">
		<decision ref="sellExists"/>
		<decision ref="outstanding"/>

The following is the xpath string I'm evaluating:

//decision [@id =//decision [supporting-class='com.csfb.fao.clr.calc.rule.OutstandingComposite']/decision/@ref/text()]/supporting-class/text()

The problem is that inside my Java code the List of nodes doesn't get populated and stays empty whereas when I'm using XPath Explorer from http://www.purpletech.com/xpe/index.jsp

it returns the expected list of supporting classes:


I'm using the following syntax in my Java code where xpathString is the expression mentioned above:

XPath x = XPath.newInstance(xpathString);
result = x.selectNodes(doc);

and the result returns empty.

I've been experimenting with passing different expressions in the hopes of maybe figuring this behavior out, and found out
that this expression works:

//decision [supporting-class='com.csfb.fao.clr.calc.rule.OutstandingComposite']/decision/@ref

but as soon as I add text() onto it, it stops working in Java, that is

//decision [supporting-class='com.csfb.fao.clr.calc.rule.OutstandingComposite']/decision/@ref/text() doesn't work.

XPath Explorer works in every case.

Please give me a hand as I don't want to resort to handcoding a bunch of loops inside of my Java code if I could use a simple XPath expression instead.

Thank you very much in advance!

	Simeon Leyzerzon

Please access the attached hyperlink for an important electronic communications disclaimer: 




Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.