Re: Using Java variables in Xtags select
Thanks Rashmi. I also got it working by creating a String object for the select and then using it instead. - Original Message From: Rashmi Rubdi [EMAIL PROTECTED] To: Tag Libraries Users List taglibs-user@jakarta.apache.org Sent: Thursday, September 28, 2006 5:24:39 PM Subject: Re: Using Java variables in Xtags select Have you set up JSTL? If you use the latest version JSTL1.1 core tags you can do this: c:set var=child_id value=someValue/ xtags:forEach context=%=parsed% select=//[EMAIL PROTECTED]/class ... /xtags:forEach Here are some JSTL installation instructions: http://jakarta.apache.org/taglibs/doc/standard-doc/standard/GettingStarted.html --- Ashish Srivastava [EMAIL PROTECTED] wrote: Hi, I am using xtags library in a JSP and am having trouble using Java variables while selecting XML nodes. The XML to be parsed is: xtags:parse id=parsed parent id=1 child id=c1 class grade=art/ class grade=science/ /child child ... /child /parent /xtags:parse xtags:forEach context=%=parsed% select=//[EMAIL PROTECTED]%=child_id%/class ... /xtags:forEach Where child_id is a Java variable defined in the JSP. The above code throws an exception complaining about '' in the expression. Even after escaping the character it does not work. I even tried with indexing like, select=//child[i]/class where i is the index of the line. The problem is the above select code returns all the child nodes instead of the index=i. Seems like its null or something. Help is highly appreciated. Thanks, -Ashish __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Java variables in Xtags select
It's good to know that you got your code working. However, using JSTL tags as mentioned in the previous post is a good programming practice. It might become evident that it is much cleaner to use than JSP scriptlets as your JSP code grows lager. All the best. --- Ashish Srivastava [EMAIL PROTECTED] wrote: Thanks Rashmi. I also got it working by creating a String object for the select and then using it instead. - Original Message From: Rashmi Rubdi [EMAIL PROTECTED] To: Tag Libraries Users List taglibs-user@jakarta.apache.org Sent: Thursday, September 28, 2006 5:24:39 PM Subject: Re: Using Java variables in Xtags select Have you set up JSTL? If you use the latest version JSTL1.1 core tags you can do this: c:set var=child_id value=someValue/ xtags:forEach context=%=parsed% select=//[EMAIL PROTECTED]/class ... /xtags:forEach Here are some JSTL installation instructions: http://jakarta.apache.org/taglibs/doc/standard-doc/standard/GettingStarted.html --- Ashish Srivastava [EMAIL PROTECTED] wrote: Hi, I am using xtags library in a JSP and am having trouble using Java variables while selecting XML nodes. The XML to be parsed is: xtags:parse id=parsed parent id=1 child id=c1 class grade=art/ class grade=science/ /child child ... /child /parent /xtags:parse xtags:forEach context=%=parsed% select=//[EMAIL PROTECTED]%=child_id%/class ... /xtags:forEach Where child_id is a Java variable defined in the JSP. The above code throws an exception complaining about '' in the expression. Even after escaping the character it does not work. I even tried with indexing like, select=//child[i]/class where i is the index of the line. The problem is the above select code returns all the child nodes instead of the index=i. Seems like its null or something. Help is highly appreciated. Thanks, -Ashish __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using Java variables in Xtags select
Hi, I am using xtags library in a JSP and am having trouble using Java variables while selecting XML nodes. The XML to be parsed is: xtags:parse id=parsed parent id=1 child id=c1 class grade=art/ class grade=science/ /child child ... /child /parent /xtags:parse xtags:forEach context=%=parsed% select=//[EMAIL PROTECTED]%=child_id%/class ... /xtags:forEach Where child_id is a Java variable defined in the JSP. The above code throws an exception complaining about '' in the expression. Even after escaping the character it does not work. I even tried with indexing like, select=//child[i]/class where i is the index of the line. The problem is the above select code returns all the child nodes instead of the index=i. Seems like its null or something. Help is highly appreciated. Thanks, -Ashish __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Java variables in Xtags select
Have you set up JSTL? If you use the latest version JSTL1.1 core tags you can do this: c:set var=child_id value=someValue/ xtags:forEach context=%=parsed% select=//[EMAIL PROTECTED]/class ... /xtags:forEach Here are some JSTL installation instructions: http://jakarta.apache.org/taglibs/doc/standard-doc/standard/GettingStarted.html --- Ashish Srivastava [EMAIL PROTECTED] wrote: Hi, I am using xtags library in a JSP and am having trouble using Java variables while selecting XML nodes. The XML to be parsed is: xtags:parse id=parsed parent id=1 child id=c1 class grade=art/ class grade=science/ /child child ... /child /parent /xtags:parse xtags:forEach context=%=parsed% select=//[EMAIL PROTECTED]%=child_id%/class ... /xtags:forEach Where child_id is a Java variable defined in the JSP. The above code throws an exception complaining about '' in the expression. Even after escaping the character it does not work. I even tried with indexing like, select=//child[i]/class where i is the index of the line. The problem is the above select code returns all the child nodes instead of the index=i. Seems like its null or something. Help is highly appreciated. Thanks, -Ashish __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]