Is there a way to automatically validate an XML document against a schema stored in the schema database? By automatic, I mean that if try to insert an invalid XML document (as per schema) using the xdmp:document-insert() function, it should not allow it and throw a relevant error.
I tried it, but even if the XML document doesn't match the schema, it is inserted without any errors. If I validate the same XML using the xdmp:validate() function, it shows errors as expected.
Note: I have added targetNamespace attribute to the schema document, and used the same namespace in the XML document.
You Cannot force MarkLogic to validate during
xdmp:document-insert()via an option on the function.I see two choices for You: