Hi Christian -
Alas, the data is a client's and confidential.
for $remote in $paths
let $name as xs:string := file:name($remote)
let $target as xs:string := file:resolve-path($name,$targetBase)
let $fetched as item() :=
http:send-request(<http:request method='get' username='{$id}' password='{$pass}' />,
$remote)[2]
return
if ($fetched instance of document-node())
then file:write($target,$fetched)
else if ($fetched instance of xs:base64Binary)
then file:write-binary($target,$fetched)
else file:write-text($target,$fetched)
works -- the query completes and files are written to disk. I suspect that server ignores override-content-type.
If I don't check the returned type and try to write everything returned out with file:write-binary() to have something where I could pick the html files back off the disk, I got an error that the content wasn't binary, it was xs:untypedAtomic. (Which might imply that file:write-binary complains that way when fed a document node.)
Which leads to "is there a way to get the type of an item?" I don't think there is, but it seems like it would be extremely helpful for stuff like this where "figure out what the web server feels like doing" is a concern.
Thank you! It was a helpful hint.
-- Graydon