Im trying have my namespace imported but for some reason it will not budge. Ive tried this as well as adding the path
import schema namespace r = "http://www.w3.org/2001/XMLSchema" at "Assignment-Xquery3.xsd";
I keep getting this error:
Error in schema http://www.w3.org/2001/XMLSchema: No valid schema was found
I tired "-Instance" as well but to no luck. I am run Saxon EE. I have tried to add my file path. Im not sure whats wrong, This is the template that my teacher has provided us.
The rest of my code if needed:
import schema namespace r = "http://www.w3.org/2001/XMLSchema" at "Assignment-Xquery3.xsd";
<provider>{
for $r in
distinc-values(doc("instance.xml")/r:patient/r:treatment/r:provider)
return
<info>
<patient>{string($r)}</patient>
{for $rr in doc("instance.xml"/r:patient
where $r = $rr/r:treatment}
return
<treatment>
<id>{$rr/r:id/text()}</id>
<diagnosis>{$rr/r:diagnosis/text()}</diagnosis>
<drug>{$rr/r:drug/text()}</drug>
</treatment>
</info>
}</provider>
It's not very clear what you are trying to achieve, but it's very clear what you are doing wrong.
When you write
import schema namespace r = "http://www.w3.org/2001/XMLSchema" at "Assignment-Xquery3.xsd";
you are
(a) trying to load a schema at the location "Assignment-Xquery3.xsd". That's probably OK; I dare say there is probably a valid schema at that location.
(b) asserting that the schema at that location has a target namespace of "http://www.w3.org/2001/XMLSchema". This seems highly unlikely, since user-written applications are very unlikely to want to access the schema for schema documents.
(c) binding the prefix "r" to that namespace. Again this seems implausible, (i) because the usual prefix that people use for that namespace is "xs" or "xsd", and (ii) because you go on to use the name r:treatment
, and there's certainly no name in this namespace with local name "treatment".
I strongly suspect, though I can't be sure, that you don't really want to import a schema at all; you just want to bind the prefix "r" to some namespace (perhaps http://www.example.org/review
, but we can't be sure). If that's the case, then you simply want
declare namespace r = "http://www.example.org/review";