Sorry for the delay, yes that's what I am doing. I didn't realize your issue was on the file system. I haven't had issue validating from the file system. 

France

On Thu, Sep 11, 2014 at 2:57 PM, Hans-Juergen Rennau <hrennau@yahoo.de> wrote:
Thank you, France, for sharing this. But I am not sure if I understand well: it seems to me you copy DTDs from the database to the file system, before using them for validation, and this seems to point at a problem with resolving references which exists only if DTDs reside in the database, rather than in the file system - is this so? But my problems with XSD validation (involving imports) occur in the file system - databases are not involved.

Kind regards,
Hans-Juergen


France Baril <france.baril@architextus.com> schrieb am 15:31 Donnerstag, 11.September 2014:


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.  






--
France Baril
Architecte documentaire / Documentation architect
france.baril@architextus.com