You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by av...@vsnl.net on 2003/06/12 10:33:13 UTC

Finding a Parent Node after Xpath Search

Hi, 

How do I get the parent node, using XpathQueryService.

My Sample Xml is : 

<organization>
	<title>Biology</title>
	<item identifier="S0" identifierref="R1">
		<title>Bio1</title>		
	</item>
	<item identifier="S1" identifierref="R2">
		<title>Bio2</title>
		<item identifier="S2" identifierref="R3">
			<title>Bio3</title>			
		</item>
	</item>
</organization>

I want to search title node string "Bio1" by Xpath and after searching it I want the corresponding "identifierref" of the parent node of title. 

How do I get it....

Avik Chatterjee

RE: Finding a Parent Node after Xpath Search

Posted by Kevin Ross <Ke...@iVerticalLeap.com>.
This is more of an xpath path question.  Please refer to a great
reference: http://dpawson.co.uk/

Here is what I would do:

/organization/item[ title = 'Bio1' ]/@identifierref

-Kevin


-----Original Message-----
From: avikchatterjee@vsnl.net [mailto:avikchatterjee@vsnl.net] 
Sent: Thursday, June 12, 2003 2:33 AM
To: xindice-users@xml.apache.org; xindice-dev@xml.apache.org
Subject: Finding a Parent Node after Xpath Search

Hi, 

How do I get the parent node, using XpathQueryService.

My Sample Xml is : 

<organization>
	<title>Biology</title>
	<item identifier="S0" identifierref="R1">
		<title>Bio1</title>		
	</item>
	<item identifier="S1" identifierref="R2">
		<title>Bio2</title>
		<item identifier="S2" identifierref="R3">
			<title>Bio3</title>			
		</item>
	</item>
</organization>

I want to search title node string "Bio1" by Xpath and after searching
it I want the corresponding "identifierref" of the parent node of title.


How do I get it....

Avik Chatterjee