You are here: XPath Query Exressions and Quote Characters « PHP « IT news, forums, messages
XPath Query Exressions and Quote Characters

Posted by C Drozdowski on 03/16/05 17:37

I've got a problem with quote characters and building XPath query
expressions (PHP 5.0.3). What do I need to do to get them to work? I've
tried various encoding functions but cannot figure it out.

Given this expression, if $id contains one or more double quotes, an
error is thrown.

$query = '//book/chapter' . '[@xml:id="' . $id . '"]';

Given this expression, if $id contains one or more single quotes, an
error is thrown.

$query = "//book/chapter[@xml:id='$id']";

I need to be able to build an exression that contains either double or
single quotes in the search regarding of how I programatically build
the expression.

Any insight would be appreciated.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация