Hi Tim, > 1. Validation can take place against a schema without a > namespace and
I haven't tried it on unnamespaced elements, but to my knowledge, you only have the validate construct that you can use: http://www.w3.org/TR/xquery/#id-validate This construct cannot be parametrized, which probably means it can only work on namespaced XML. I am sure it needs the namespace to retrieve the appropriate XML schema. It is possible though to apply a namespace to all elements on the fly an pass that to the validate construct. A precommit trigger would be quite suitable for this, so it would apply to webdav inserts as well. > 2. The loader will ignore the DTD reference in the XML document. DOCTYPE will ignored. In fact I believe the whole prolog is removed upon storage in MarkLogic database. Make sure to anticipate on the source encoding though, if it might vary. You might need to analyse the prolog yourself before calling document-insert. In this thread some tips how to handle this: http://markmail.org/thread/74zeihtzez4mjnc4 Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of > Tim Meagher > Sent: vrijdag 30 oktober 2009 14:42 > To: 'General Mark Logic Developer Discussion' > Subject: [MarkLogic Dev General] Validating an XML document > in MarkLogic that references a DTD as part of a precommit trigger > > 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
