Hi Neil, You are correct, there was a bug fix in 4.1-2 that further tested for the validity of the search string, as it should.
The long-and-short of it is that you must construct valid regular expression strings or an exception is thrown. -Danny -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Neil Bradley Sent: Thursday, January 21, 2010 11:21 PM To: 'General Mark Logic Developer Discussion' Subject: RE: [MarkLogic Dev General] Problem with ML 4.1-4 and MLJAM Jason, I have solved the problem, but I it is wrong to say this is a problem with MLJAM as such. In fact, I had NOT updated my version, and the older MLJAM still works fine without the fix in ML 4.1-1. I tried the following code in CQ under both versions of ML, and it works fine on my MK 4.1-1, but I get the error on my client's ML 4.1-4. So the ML code for the fn:replace() function has changed: replace('quote this now!', '"', '\"') However, if I actually include quotes in the source string, then I too DO get the error message. So I think in older versions of ML the test for validity of the replacement string only happened if there were matches for the find string, whereas now the replacement value is tested even if there are no matches. Neil. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jason Hunter Sent: 21 January 2010 22:09 To: General Mark Logic Developer Discussion Subject: Re: [MarkLogic Dev General] Problem with ML 4.1-4 and MLJAM Hi Neil, Your client should upgrade their MLJAM library to 1.2.1 which fixes this. You probably already did, which is why you don't have a problem. http://xqzone.marklogic.com/svn/mljam/releases/ -jh- On Jan 21, 2010, at 1:34 PM, Neil Bradley wrote: > Hi, > > I am using 4.1-1 and do not have a problem. My client is using 4.1-4 and gets the following error, which I have pinpointed to the MLJAM function here (the second replace): > > define function jam:_escape-string( > $s as xs:string > ) as xs:string > { > (: These replaces funny because arg2 is a regexp and arg3 is a literal :) > let $s := replace($s, '\\', '\\') (: \ replaced with \\ :) > let $s := replace($s, '"', '\"') (: " replaced with \" :) > let $s := replace($s, '
', '\n') > return $s > } > > Has the interpretation of the fn:replace() function changed in the latest version? How to I overcome this problem and get MLJAM working again? > > XDMP-BADREP: (err:FORX0004) fn:replace("data/internationalSwapsAndDerivativesAssociation/masterAgreement ...", """, "\"") -- Invalid replacement string: \" > in /jam.xqy, on line 634, > > Thanks. > > Neil. > > > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
