6

I am using MLCP(Marklogic Content Pump) for copying content from one database to another. In this i'm using -query_filter option and its value is a cts:query in XML serialized format of a set of cts:element-range-query wrapped in cts:and-query :

<cts:and-query xmlns:cts="http://marklogic.com/cts">
  <cts:element-range-query operator=">">
    <cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
    <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2000-12-21T00:00:00Z</cts:value>
  </cts:element-range-query>
  <cts:element-range-query operator="&lt;">
    <cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
    <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2016-12-21T00:00:00Z</cts:value>
  </cts:element-range-query>
</cts:and-query>

Now, the above query returns valid result when executed on ML Qconsole, but when passed in -query_filter option of MLCP, it gives the error saying 'Invalid attribute value character '<' .

The version of Marklogic and MLCP is 8.0-5.

On further digging into this I observed that the issue is only when the operator value is less than '<'

Note: I have configured a valid range-index on the database for the element "released-on".

Ankit Bhardwaj
  • 754
  • 8
  • 27

1 Answers1

1

MarkLogic encourages the use of options files when using a cts query serialized as XML, because special characters can be interpreted by the underlying OS on the command line.

My first guess would be to try creating a file, say, options.txt with the content:

--query_filter
<cts:and-query xmlns:cts="http://marklogic.com/cts">
  <cts:element-range-query operator=">">
    <cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
    <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2000-12-21T00:00:00Z</cts:value>
  </cts:element-range-query>
  <cts:element-range-query operator="&lt;">
    <cts:element xmlns:c="http://iddn.icis.com/ns/core">c:released-on</cts:element>
    <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2016-12-21T00:00:00Z</cts:value>
  </cts:element-range-query>
</cts:and-query>

(You may have to make all the XML fit on the same line of that file though)

and then invoke MLCP with

mlcp.sh -options_file options.txt ...

Sofia
  • 771
  • 1
  • 8
  • 22
Ghislain Fourny
  • 6,971
  • 1
  • 30
  • 37
  • That's exactly what i'm doing currently. All the concerned options are wrapped in a options.txt file and I'm executing the same command mentioned above. – Rachit Rampal Jul 07 '16 at 04:34
  • I see. It sounds strange indeed, because the XML is well-formed as it is. Something I had in mind in case there's a bug somewhere and "<" gets resolved to "<" too early in the pipeline: have you tried "&lt;" instead "<"? – Ghislain Fourny Jul 07 '16 at 07:52
  • I tried using '&lt;' as well but got the same error – Rachit Rampal Jul 08 '16 at 11:59
  • Could the version of the old database be less than 4.0? MarkLogic documents that it used to incorrectly allow for "<" in attributes. Maybe there is somewhere else (query, data) where this character appears. – Ghislain Fourny Jul 08 '16 at 18:25