marklogic - XQuery file returning invalid entity reference using special characters -


i have following query in marklogic xquery file, , seeing following error message returned

xdmp-entityref: (err:xpst0003) invalid entity reference " " . see marklogic server error log further detail. 

the following code using in xquery file.

xquery version "1.0-ml";  declare variable $query :=     cts:or-query   ((     cts:element-word-query(xs:qname("lines"),"l&l"),     cts:element-word-query(xs:qname("lines"),"pool & cue"),     cts:element-word-query(xs:qname("lines"),"look")   ));  declare function local:do-query(){   element xml {     $i in cts:uris( (), (), $query)     let $item := doc($i)      return       element item {         element title { $item/title/string() }     }   } };  local:do-query() 

obviously 2x tags looking l&l , pool & cue. have looked repair-full suggestion in question posted, couldn't figure out how fits query. if removed ones special characters, works expected.

any ideas?

based on additional info in comments question, not issue execution of code, rather deployment of code.

this happens if insert code using qconsole, or other ways in evaluate xquery code. & interpreted, , translated & character represents. if write .xqy file modules database, not escaped & again, since xquery files stored plain text in marklogic, , & doesn't escaped in plain text.

a better way deploy code uploading or inserting disk. way characters &, >, , { inside xml won't interpreted, preserved , inserted is. there tools ml-gradle , roxy make deploying marklogic code easy. consider using these. alternatively using curl against management rest api.

if want use qconsole after all, escape characters & twice. e.g. & becomes &amp;amp;, , < becomes &amp;lt;.

hth!


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -