Highlighted

XPath Query with /* only returns the first node?

Avatar

Guest

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

Highlighted

Avatar

Guest

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
Highlighted

Avatar

Guest

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.