Re: [xml] contains() argument treated like XPath expression



On Thu, Jul 24, 2003 at 04:59:44PM -0400, Larry Siden wrote:
I looked in the code for the "contains(string)" function the other day 
and noticed that its argument is handed off to another routine that 
parses it as if it were an XPath expression.  Since contains() is used 
for string searches, wouldn't it be better to parse its argument as a 
regular expression? 

  the function is defined there:
    http://www.w3.org/TR/xpath#function-contains
 and its definition does not relates to regexp.

I haven't taken the time to research it, but I'll 
bet there's a number of open source regular-expression libraries that 
can parse and search for the expression.  At the very least, I would 
expect the argument to be treated as a literal string with special 
character sequences, like '\n', recognized so that it is possible to 
search for an end-of-line, for example.  If anyone is interested in 
this, and Daniel V. grants his blessing, I will volunteer to look into 
doing it, because this feature might have helped me on one of my projects.

  If the purpose is to extend the function as to make it non conformant
to the defintion, then I disagree. If you want regexp support implement
some EXSLT based functions, but do not break the conformance of the 
existing XPath implementation. Concerning regexp, there is some support
in libxml2 and I do not agree to use an external library for regexp support
for portability reasons.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]