OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   XPath selectNodes() returns empty List

[ Lists Home | Date Index | Thread Index ]

Hi,

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-process>
	<decision type="primitive" id="fppLogic">
		<rule-file>FPPLogic.drl</rule-file>
		<supporting-class>com.csfb.fao.clr.calc.rule.FacilPortfPosition</supporting-class>
	</decision>
	<decision type="primitive" id="sellExists">
		<rule-file>SellExists.drl</rule-file>
		<supporting-class>com.csfb.fao.clr.calc.rule.PortfolioParticipationSell</supporting-class>
	</decision>
	<decision type="primitive" id="outstanding">
		<rule-file>OutstandingLogic.drl</rule-file>
		<supporting-class>com.csfb.fao.clr.calc.rule.Outstanding</supporting-class>
	</decision>
	<decision type="composite" id="outstandingComposite">
		<supporting-class>com.csfb.fao.clr.calc.rule.OutstandingComposite</supporting-class>
		<!--<decision type="primitive" name="sellExists">
			<rule-file>SellExists.drl</rule-file>
			<supporting-class>com.csfb.fao.clr.calc.rule.PortfolioParticipationSell</supporting-class>
		</decision>-->
		<decision ref="sellExists"/>
		<decision ref="outstanding"/>
	</decision>
</decision-process>

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:

com.csfb.fao.clr.calc.rule.PortfolioParticipationSell
com.csfb.fao.clr.calc.rule.Outstanding

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: 

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

==============================================================================





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS