eerohele / exalt

A Sublime Text plugin for validating and formatting XML documents
MIT License
22 stars 3 forks source link

Exalt is silent, when schematypens is missing from xml-model PI #4

Closed huttarl closed 7 years ago

huttarl commented 7 years ago

On Mac OS X, Sublime Text 3, with Exalt 0.3.0:

I installed Exalt, and opened an XML file that had the following xml-model PI:

<?xml-model href="msconfig.rng" ?>

The rng file was in the same folder as the XML file.

When I pressed Cmd+Ctrl+V, there was no response: no error, no change of the status bar (bottom of window), nothing. I tried this with the XML being well-formed, not-well-formed, valid, and invalid. No response.

Through experimentation, I found that it works if you include the schematypens attribute:

<?xml-model href="msconfig.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>

Now I get a "Valid XML" message, or a validation error message, whenever I save or press Ctrl+Cmd+V.

The docs do say to use a "processing instruction like this", and show an example that includes the schematypens attribute, but the docs are not specific about whether that attribute is required. My processing instruction is not "like this" in various ways (e.g. the structure of the href path), but apparently those ways don't matter, except for the schematypens attribute. That attribute is not required in the W3C standards that the docs link to, so it's not obvious that it would be required by Exalt.

Recommendations:

Thanks for a useful tool. The availability of Exalt makes it more likely that my co-workers who are editing copies of an XML config file will validate their work.

eerohele commented 7 years ago

Thank you for the detailed bug report and the suggestions!

I'll take a look whether I could modify the code so that the @schematypens attribute isn't required, and if not, I'll modify the documentation as you suggested.

eerohele commented 7 years ago

Version 0.3.1 should fix the issue. Exalt now tries to auto-detect the schema type based on the file extension of the path in the @href attribute.

It'll take a while to show up in Package Control, but when it does, could you please give it a go and let me know whether that fixes the issue for you? Thanks!

huttarl commented 7 years ago

I thought I had replied here, but I don't see it so I'll comment again. Thank you for the quick fix! Version 0.3.1 is up on Package Control. SublimeText says I'm now running Exalt 0.3.1.

Unfortunately, when I type Cmd+Ctrl+V, I still see no response ... But now this is the case even when I have the schematypens attribute!

In other words, I used to see a validation message when the schematypens attribute is present, and not otherwise. Now I don't see a validation in either case.

And still, there's no error message when validation is not performed. So it's not even possible to be sure that I'm invoking validation correctly.

huttarl commented 7 years ago

I closed the XML file and re-opened it. Now Exalt validation works correctly. I guess before, Exalt got (silently) updated after the XML file had been opened, so maybe the new code didn't run?

eerohele commented 7 years ago

I guess before, Exalt got (silently) updated after the XML file had been opened, so maybe the new code didn't run?

That's very likely.

Just a clarification, though: do you mean that the issue has been fixed for good, or that you need to reopen the XML file every time before validation starts working?

eerohele commented 7 years ago

It seems that this issue is resolved, so I'm closing it. If you have any further problems or questions, please feel free to add a comment here.