Search code examples
marklogicmarklogic-10

MarkLogic 10 document format change when editing with Query Console


After doing the upgrade to MarkLogic 10, we are seeing a issue with Query console where document format is getting changed if we edit it from QC.

Steps to recreate :-

Step 1 :- Insert a small XML doc using QC

xquery version "1.0-ml";
let $doc := 
<Football>
<Team><ManchesterUnited> United finished 2nd in PL </ManchesterUnited></Team>
</Football>
for $i in 1 to 5
return xdmp:document-insert ('/England/PL/ManchesterUnited/'||$i||'', $doc)

Step 2 :- Check One Document format like below

let $x:= doc("/England/PL/ManchesterUnited/1")/node()
return
typeswitch ( $x )
 case element() return "xml element node"
 case text() return "text node"
 case binary() return "binary node"
default return "don't know"

Output will be "xml element node"

Step 3:- Edit the document from query console click "Edit", and change element value.

for ex

<ManchesterUnited> United finished 2nd in PL </ManchesterUnited>

to

<ManchesterUnited> Manchester United are the new champions </ManchesterUnited>

Step 4 :- Run the step 2 again and now the format of document is changed to "text node".

Any Suggestion on how we can avoid this?


Solution

  • This is due to a bug in Query Console in which documents that do not have a file extension in the URI are being saved as text(). It will be addressed in future MarkLogic releases.

    For now, avoid using the Query Console edit feature for documents who's URIs do not have a file extension, or consider applying ".xml" suffix for such XML documents.