Closed DavorPadovan closed 5 years ago
I don't think Exalt correctly accounts for that scenario at the moment because I didn't know you can refer to more than one schema location. I'll look into it.
Actually, I remembered wrong: it looks like Exalt always uses the last entry in the schemaLocation
or noNamespaceSchemaLocation
attribute.
I don't know that that's the smartest way for Exalt to work, but it means that you could try adding something like this into your XML catalog:
<system systemId="validation-rules.xsd" uri="file:///C:/SW/schemas/validation-rules.xsd"/>
Remember to restart Sublime Text after making that change for the changes to take effect.
Please let me know whether that solves the issue for you.
In fact (refreshing my memory here, been a while since I've needed to work with this stuff…), it seems that xsi:schemaLocation="http://example.com/schemas/validation-rules.xsd validation-rules.xsd"
is basically a hint that says:
The XML schema for XML nodes in the
http://example.com/schemas/validation-rules.xsd
namespace is located atvalidation-rules.xsd
.
So in that sense, the current behavior seems more or less correct and adding a <system>
entry like the one I described above is probably your best bet.
The solution you described above is working. But the problem is that we have a lot of different XSD schemas with the same name - we distinguish them by domain name, not by filename.
I see. I'll need to look into how to best solve that issue.
Exalt's implementation of schemaLocation
is somewhat naïve and probably incorrect, but I'm having trouble finding definitive information on how it should work. I honestly don't have the time (or the inclination) to try to glean the information from the W3C specification, either.
A simple way to fix this would be to use the namespace (the bit preceding the space in the xsi:schemaLocation
attribute) instead of the URI hint (the bit following the space).
However, that might break backwards compatibility for some users, which I don't want to do.
I'll try to see if I can modify the code to account for both options.
This should be fixed in v0.3.7.
I think you'll need to add something like this in your XML catalog:
<system systemId="http://example.com/schemas/validation-rules.xsd" uri="file:///C:/SW/schemas/validation-rules.xsd"/>
It'll take a while for the new version to land in Package Control, but once it does, could you give it a go and let me know whether it fixes the issue for you?
Thank you! I will try this approach.
It works! Even without changing my catalog.xml file. Thank you again!
Glad to hear it!
XML I'm trying to validate has multiple schemaLocation entries:
xsi:schemaLocation="http://example.com/schemas/validation-rules.xsd validation-rules.xsd"
I also have catalog.xml set up to rewrite public schemas to local FS:
<rewriteURI uriStartString="http://example.com/schemas/" rewritePrefix="file:///C:/SW/schemas/" />
But this doesn't work as expected. It works only if I remove second part (validation-rules.xsd) from schemaLocation value. Is there any way to ignore this part?