Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2008, 02:15 PM
Authorized User
 
Join Date: Jun 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default XPath Error : Expression Expected

Hello, I got an error for my XPath...

The error said "Expression Expected"

Here is my Xpath:
path="form/document[contains(<%=request.Form("search_by")%>,'<%= request.Form("txtSearch")%>')]//*";

the error pointed to ","

I do not know what kind of expression should be put there.

Can someone help me

Thanks

 
Old June 14th, 2008, 05:57 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Here is my Xpath:
path="form/document[contains(<%=request.Form("search_by")%>,'<%= request.Form("txtSearch")%>')]//*";


I told you a few hours ago: this is not an XPath [expression], it is an ASP|JSP|PHP construct that generates an XPath expression. (Why do you ask questions on this forum if you are going to ignore the answers?)

Presumably on this occasion the ASP|JSP|PHP construct has generated an invalid XPath expression, which it would do for example if <%=request.Form("search_by")%> evaluated to an empty string.

I also told you that you need to prevent injection attacks when writing this kind of code, more advice that you seem to have ignored completely.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath 2.0 every expression stolte XSLT 5 November 24th, 2008 03:32 PM
Expected Expression before')' token page 212 line martyds BOOK Beginning Linux Programming, 3rd Edition 0 November 9th, 2008 04:44 PM
Expected values in a condition, XPath 1.0 akentanaka XSLT 2 June 27th, 2008 05:48 AM
Need help with XPATH Expression benomathew XML 1 May 9th, 2006 03:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.