Forum Stats

  • 3,751,473 Users
  • 2,250,366 Discussions


XQuery contains function failing due to carriage return in XML

537206 Member Posts: 12
edited Aug 1, 2012 7:10AM in Berkeley DB XML
I am trying to perform the following xquery:

declare namespace tei="";

for $line in //tei:l
where some $value in $line
satisfies (contains($value, "A cherdd, myn Siat"))
return $line

this works fine for almost all cases except when al 'l' element contains a carriage return half way through it, e.g.

<l n="15">A cherdd, myn Siat, yn

if I try to run the xquery above again to find the whole contents of the 'l' element it fails due to the carriage return

declare namespace tei="";

for $line in //tei:l
where some $value in $line
satisfies (contains($value, "A cherdd, myn Siat, yn batent"))
return $line

I've been reading all the usual guides/sites and it seems that it might be possible to mitigate the effects of the 'carriage return' by the use of indexes. What I would really like to do however is to remove all the carriage returns. Does anyone know if it is possible to issue a command to dbxml to do this or should I just continue to investigate indexes?

thanks in advance

Edited by: user534203 on 27-Jul-2012 02:05


  • 537206
    537206 Member Posts: 12
    I have found a solution to my problem.

    Basically, the problem was that my XML editor, Oxygen, has a 'pretty print' formatting command which cause windows line breaks to be introduced when XML lines get too long to make things easier to read.

    I was saving the files with these line breaks included. Instead I should have been saving the files using the Document>Source>Join and Normalize menu option (Ctrl J). This removes all of the offending line breaks and solves the search problem within the db.

    Hope this helps someone out there.

This discussion has been closed.