I just want to second that suggestion! In the mean time, Hans, what I do id
this:

*let **$xsd-file-path* := *fix-validation:update-file-system-dtds-xsds*(
*$xsd*)
*return **validate:xsd*(*$file*, *$xsd-file-path*)


...


*declare function **fix-validation:update-file-system-dtds-xsds*(*$dtd* *as
**xs:string*) *as **xs:string*{
    *let **$to-file-sys*:= *for **$db-url* *in **db:list*('AppResources',
'dtds')
                       *let* *$target-file* := *concat*('BaseX-DTDs/',
*substring-after*(*$db-url*, 'dtds/'))
                       (:let $debug := file:write('debug-dtd-2-file.xml',
$target-file):)
                       *let* *$dir* := *file:parent*(*$target-file*)
                       *let* *$create-dir* := *if* (*file:exists*(*$dir*))
                                          *then *()
                                          *else **file:create-dir*(*$dir*)
                       *return **file:write*(*$target-file*, *db:open*(
'AppResources', *$db-url*))

    (: Get the new file path for db equivalent $dtd :)
    *let* *$dtd-on-file-sys* :=  *concat*('BaseX-DTDs/', *substring-after*(
*$dtd*, 'dtds/'))
    (: Return path to file system copy of the DTD :)
    *return **$dtd-on-file-sys*
};


Our XSDs change enough and our drop cycle is fast enough, that it's worth
doing this on each validation to avoid confusion between schema versions in
2 locations. We need the .xsd in BaseX because we parse them for dynamic
documentation. Otherwise, you might want to keep the .xsd files outside of
BaseX.


I don't remember if that worked with .xsd, but with .dtds and .css saving
the files as raw instead of text enabled the resolution of dependents. Of
course, if you need to xquery your schemas, saving them as raw is not an
option.

Reply via email to