Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

XPath Query with /* only returns the first node?

Avatar

08-05-2008

Hi,<br /><br />I'm using the JDBC Query for Multiple Rows as XML service option to produce the following XML:<br /><br />[5/8/08 14:52:30:674 EDT] 00000043 VariableLogge A com.adobe.idp.dsc.variablelogger.VariableLoggerService log [PID:-1] /process_data/userQueryResult - XML Document: <br /> <UserList><br /> <User><br /> <firstName type="VARCHAR2">firstname_1</firstName><br /> <lastName type="VARCHAR2">lastname_1</lastName><br /> <userId type="VARCHAR2">userid_1</userId><br /> </User><br /> <User><br /> <firstName type="VARCHAR2">firstname_2</firstName><br /> <lastName type="VARCHAR2">lastname_2</lastName><br /> <userId type="VARCHAR2">userid_2</userId><br /> </User><br /> <User><br /> <firstName type="VARCHAR2">firstname_3</firstName><br /> <lastName type="VARCHAR2">lastname_3</lastName><br /> <userId type="VARCHAR2">userid_3</userId><br /> </User><br /> <User><br /> <firstName type="VARCHAR2">firstname_4</firstName><br /> <lastName type="VARCHAR2">lastname_4</lastName><br /> <userId type="VARCHAR2">userid_4</userId><br /> </User><br /></UserList><br /><br />In a SetValue serivce I have defined the following mapping (xmlFrag is an XML variable):<br /><br />Location : /process_data/xmlFrag/root<br />Expression: /process_data/userQueryResult/UserList/*<br /><br />However, the mapping only ever returns the first <User> node.<br /><br />[5/8/08 14:52:30:706 EDT] 00000043 VariableLogge A com.adobe.idp.dsc.variablelogger.VariableLoggerService log [PID:-1] /process_data/xmlFrag - XML Document: <br /> <root><br /> <User><br /> <firstName type="VARCHAR2">firstname_1</firstName><br /> <lastName type="VARCHAR2">lastname_1</lastName><br /> <userId type="VARCHAR2">userid_1</userId><br /> </User><br /></root><br /><br />I have also tried the following mapping expressions, but each produce the same result.<br /><br />Expression: /process_data/userQueryResult/UserList/User<br /><br />Expression: /process_data/userQueryResult/UserList/User[*]<br /><br />I am able to extract a single <User> node with the expression<br /><br />Expression: /process_data/userQueryResult/UserList/User[2]<br /><br />But I am not able to get the complete list of <User> nodes.<br /><br />Any help would be greatly appreciated.<br />Thanks.

Replies

Avatar

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile
Jasmin_Charbonn
Level 10

08-05-2008

Are you on 8.0.1.2?



I have had similar xml manipulation issues with 8.0.1 before.



Jasmin

Avatar

08-05-2008

I think you will have to loop through the xml to get each user individually.First get a count of the users using one of the nodeset functions which will return you the count of the users, then loop through the xml to get each individual user

hope this helps

Avatar

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile
Jasmin_Charbonn
Level 10

09-05-2008


Avatar

11-05-2008

Thanks for the quick replies.



I found that if I use the serialize function on the XPath expression



/process_data/userQueryResult/UserList/User



it does return all instances of the User element as expected. Anyway, for now I'm able to

use the XSLT service to do what I need, but it would be nice to know how to get this work.



Thanks.