Hi Folks,
I would like to validate XML documents in MarkLogic as they are inserted during an HTTP POST so that I can read any validation errors from the post response and take any necessary action. The HTTP POST module employs xdmp:document-insert() to perform the inserts. The problem is that the XML documents reference a DTD and not an XML schema. There is also no namespace involved. I'm wondering if I can explicitly invoke the validate function using an XML schema instead of the referenced DTD prior to inserting the document as part of a precommit trigger and to return any errors as necessary. The assumptions I am making are that: 1. Validation can take place against a schema without a namespace and 2. The loader will ignore the DTD reference in the XML document. Here's an example of the DTD reference: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE record SYSTEM "Archive-1.0.dtd"> <record> . </record> I need to validate against the schema form of the DTD, i.e. Archive-1.0.xsd. I could replace the DTD reference with an XML schema reference in the XML file prior to loading it into ML, but I prefer to perform all content manipulation in MarkLogic. Does this sound feasible? Can anyone provide a code snippet of performing validation as part of a precommit trigger? Thank you! Tim Meagher
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
