Coder Social home page Coder Social logo

exalt's Introduction

I pretend I know how to program, mostly Clojure.

exalt's People

Contributors

eerohele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

exalt's Issues

Auto-Completion based on scheme.

Some XML editors provide a context sensitive auto-completion feature, which suggests valid items to add.

Is something like that possible to include in exalt or is it meant for validation only?

`exalt_format` raises errors in console when used in non-xml files

When used without a selection:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 1088, in run_
    return self.run(edit)
  File "C:\Users\Jakub\AppData\Roaming\Sublime Text 3\Packages\Exalt\impl\plugin.py", line 72, in run
    view.replace(edit, region, formatted)
  File "C:\Program Files\Sublime Text 3\sublime.py", line 837, in replace
    sublime_api.view_replace(self.view_id, edit.edit_token, r, text)
TypeError: String required

When used with a selection:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 1088, in run_
    return self.run(edit)
  File "C:\Users\Jakub\AppData\Roaming\Sublime Text 3\Packages\Exalt\impl\plugin.py", line 103, in run
    xml = self.indent(formatter.format_region(view, region), region)
  File "C:\Users\Jakub\AppData\Roaming\Sublime Text 3\Packages\Exalt\impl\plugin.py", line 96, in indent
    lines = map(partial(self.indent_line, region), xml_string.splitlines())
AttributeError: 'NoneType' object has no attribute 'splitlines'

Ignore multiple schemaLocation

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?

Schema Hinting/Number of spaces for formatting

Great plugin! I have been hoping for a long time that someone would make a package that will validate against an xsd schema.

I have two requests:

  1. Can you make the number of spaces for XML formatting configurable? I didn't see a way to do that with your current version.
  2. This is a bigger request, but code hinting based on xsd or other schemas would be a great feature.

Thanks for the package!

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

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:

  • If Exalt requires something in order to validate (e.g. the schematypens attribute), and doesn't find what it requires, output a message saying what it needs. With no output at all, the user is left wondering whether Exalt is just not installed correctly, or it doesn't support RelaxNG validation, or ... who knows.
  • Document clearly the fact that the schematypens attribute is required. The less guesswork the user has to do, the more likely he will be to successfully begin using this tool vs. moving on to look for another one.

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.

Validating Magento 2 XML files

I'm trying to make Exalt to work with Magento 2 xml files for validation. Its xml files could start with e.g.:

<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">

and that urn points to schema.xsd file in (starting from root directory):

ROOT/vendor/Magento/framework/Setup/Declaration/Schema/etc/schema.xsd

I have generated a catalog file named misc.xml with the built in Magento command which contains:

<?xml version="1.0"?>
<project version="4">
  <component version="2" name="ProjectRootManager"/>
  <component name="ProjectResources">
    <resource url="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd" location="D:/path/to/Magento/vendor/magento/framework/Setup/Declaration/Schema/etc/schema.xsd"/>
    <resource url="urn:magento:framework:ObjectManager/etc/config.xsd" location="D:/path/to/Magento/vendor/magento/framework/ObjectManager/etc/config.xsd"/>
.
.
.

and gave it to Exalt:

{
    "xml_catalog_files": [
        "D:/path/to/Magento/misc.xml"
    ]
}

But Exalt throws error on not finding urn (Failed to locate the main schema resource...). Is there anyway to configure Exalt to understand the file path?
Thanks

Default keybindings can interfere with AltGr bindings in regional keyboard layouts

Regional keyboard layouts like Polish use AltGr (which Sublime translates to Ctrl+Alt, at least on Windows) to be able to type some characters with diacritics. For example, in Polish layout the bindings: AltGr+e, AltGr+o, AltGr+a, AltGr+s, AltGr+l, AltGr+z, AltGr+x, AltGr+c, AltGr+n (and also the same binding with addition of Shift to write capital letters) are used for writing ę, ó, ą, ś, ł, ż, ź, ć, ń characters.

It might be worth changing those default keybindings to not interfere with such layouts.

undefined symbol: PyExc_ImportError

Trying Exalt in Sublime 3180 on Ubuntu 18.10, no commands appear in the command palette. The following error appears in the console:

reloading plugin Exalt.impl.plugin
Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 283, in on_api_ready
    m.plugin_loaded()
  File "/home/jtojnar/.config/sublime-text-3/Packages/Exalt/exalt.py", line 84, in plugin_loaded
    sublime_plugin.reload_plugin("%s.impl.plugin" % constants.PLUGIN_NAME)
  File "/opt/sublime_text/sublime_plugin.py", line 116, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 868, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "/home/jtojnar/.config/sublime-text-3/Packages/Exalt/impl/plugin.py", line 28, in <module>
    from lxml import etree
ImportError: /home/jtojnar/.config/sublime-text-3/Packages/lxml/st3_linux_x64/lxml/etree.cpython-33m.so: undefined symbol: PyExc_ImportError

External DTD Validation not working

Exalt doesn't detect the external DTD file or maybe it detects but can't read the definitions in the file when I select Validate Document. It works perfectly with Internal DTD and XSD files.
And thank you for making this plugin. Really made my work easy.

1. Summary

Doesn't read the DTD definitions in the external DTD file.

2. Expected Behavior

Should notify "Valid markup".

3. Actual Behavior

Didn't read the definitions and notified "No declarations for element bookDB".

4. Code Used

XML File- bookDB.xml
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE bookDB SYSTEM "bookDB.dtd">

<bookDB>
	<book>
		<name>Five Point Someone</name>
		<author>Chetan Bhagat</author>
	</book>
	<book>
		<name>I Too Had A Love Story!</name>
		<author>Ravindra Singh</author>
	</book>
	<book>
		<name>Goosebumps - The Werewolf of Fever Swamp</name>
		<author>R. L. Stine</author>
	</book>
</bookDB>

DTD File- bookDB.dtd

<!ELEMENT bookDB (book+)>
<!ELEMENT book (name,author)>
<!ELEMENT name (CDATA)>
<!ELEMENT author (CDATA)>

5. Environment

Operating System: Windows 8.1 x64 EN
Sublime Text: Build 3126

Thanks.

[Bug] TypeError: 'NoneType' object is not iterable

1. Summary

I get stack trace in console, when I run Sublime Text.

2. Expected behavior

No stack trace in console.

3. Actual behavior

Stack trace 1:

reloading plugin Exalt.constants
reloading plugin Exalt.encodings
reloading plugin Exalt.exalt
reloading plugin Exalt.impl.plugin
Traceback (most recent call last):
  File "D:\Sublime Text Build 3126 x64 For Debug\sublime_plugin.py", line 157, in reload_plugin
    m.plugin_loaded()
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Exalt\exalt.py", line 84, in plugin_loaded
    sublime_plugin.reload_plugin("%s.impl.plugin" % constants.PLUGIN_NAME)
  File "D:\Sublime Text Build 3126 x64 For Debug\sublime_plugin.py", line 109, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 868, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Exalt\impl\plugin.py", line 18, in <module>
    os.environ["XML_CATALOG_FILES"] = exalt.get_catalog_files()
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Exalt\exalt.py", line 64, in get_catalog_files
    catalog_urls = map(lambda file: file_to_uri(file), catalog_files)
TypeError: 'NoneType' object is not iterable
reloading settings Packages/Exalt/Exalt.sublime-settings
reloading plugin Exalt.messages
reloading plugin Exalt.namespaces
reloading plugin Exalt.settings
reloading plugin Exalt.utils
reloading plugin Exalt.view
reloading settings Packages/Exalt/XSLT.sublime-settings

Stack trace 2:

reloading plugin Exalt.impl.plugin
Traceback (most recent call last):
  File "D:\Sublime Text Build 3126 x64 For Debug\sublime_plugin.py", line 210, in on_api_ready
    m.plugin_loaded()
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Exalt\exalt.py", line 84, in plugin_loaded
    sublime_plugin.reload_plugin("%s.impl.plugin" % constants.PLUGIN_NAME)
  File "D:\Sublime Text Build 3126 x64 For Debug\sublime_plugin.py", line 109, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 868, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Exalt\impl\plugin.py", line 23, in <module>
    from lxml import etree
ImportError: DLL load failed: The specified module could not be found.

4. Steps to reproduce

I reproduce the problem in a version of Sublime Text without plugins and user settings.

I install Exalt via Package Control → I get stack trace 1. I restart Sublime Text → I get stack trace 2.

5. Environment

Operating system and version:
Windows 10 Enterprise LTSB 64-bit EN
Sublime Text:
Build 3126
Python
3.6.0
lxml:
3.7.3

Thanks.

Canonical xml using Exalt

Is it possible to Canonicalize xml using Exalt? I have seen that lxml is a dependency. I can't find any option to canonicalize xml.

Entities in external DTD are neglected

Hi,

thank you for that cool package. I don't feel misfortunate. :)

Issue-8 was reported and fixed which I am very happy about. This one is related though.

I noted that entity declarations within external DTDs are neglected.

(1) This works:
messages.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE catalogue SYSTEM "catalogue.dtd" [
  <!ENTITY nbsp "&#160;">
  <!ENTITY shy "&#173;">
  <!ENTITY reg "&#174;">
  <!ENTITY trade "&#8482;">
  <!ENTITY ndash "&#8211;">
  <!ENTITY mdash "&#8212;">
  <!ENTITY rsquo "&#8217;">
]>
<catalogue xml:lang="de" name="messages">
  <message key="banner.title">Hello&shy;World</message>
</catalogue>

catalogue.dtd:

<!ELEMENT catalogue (message)>
<!ATTLIST catalogue name ID #REQUIRED>
<!ELEMENT message (#PCDATA)>
<!ATTLIST message key ID #REQUIRED>

(2) While this does not work:
messages.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE catalogue SYSTEM "catalogue.dtd">
<catalogue xml:lang="de" name="messages">
  <message key="banner.title">Hello&shy;World!</message>
</catalogue>

catalogue.dtd:

<!ELEMENT catalogue (message)>
<!ATTLIST catalogue name ID #REQUIRED>
<!ELEMENT message (#PCDATA)>
<!ATTLIST message key ID #REQUIRED>
<!ENTITY nbsp "&#160;">
<!ENTITY shy "&#173;">
<!ENTITY reg "&#174;">
<!ENTITY trade "&#8482;">
<!ENTITY ndash "&#8211;">
<!ENTITY mdash "&#8212;">
<!ENTITY rsquo "&#8217;">

(3) And also this more advanced example doesn't work:

messages.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE catalogue SYSTEM "catalogue.dtd">
<catalogue xml:lang="de" name="messages">
  <message key="banner.title">Hello&shy;World</message>
</catalogue>

catalogue.dtd:

<!ELEMENT catalogue (message)>
<!ATTLIST catalogue name ID #REQUIRED>
<!ELEMENT message (#PCDATA)>
<!ATTLIST message key ID #REQUIRED>
<!ENTITY % iso-lat1
	PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML"
		"iso-lat1.ent">
%iso-lat1;
<!ENTITY % iso-lat2
	PUBLIC "ISO 8879:1986//ENTITIES Added Latin 2//EN//XML"
		"iso-lat2.ent">
%iso-lat2;

iso-lat1.ent:

...
<!ENTITY aacute	"&#x00E1;"> <!-- LATIN SMALL LETTER A WITH ACUTE -->
<!ENTITY Aacute	"&#x00C1;"> <!-- LATIN CAPITAL LETTER A WITH ACUTE -->
<!ENTITY acirc	"&#x00E2;"> <!-- LATIN SMALL LETTER A WITH CIRCUMFLEX -->
<!ENTITY Acirc	"&#x00C2;"> <!-- LATIN CAPITAL LETTER A WITH CIRCUMFLEX -->
<!ENTITY agrave	"&#x00E0;"> <!-- LATIN SMALL LETTER A WITH GRAVE -->
<!ENTITY Agrave	"&#x00C0;"> <!-- LATIN CAPITAL LETTER A WITH GRAVE -->
<!ENTITY aring	"&#x00E5;"> <!-- LATIN SMALL LETTER A WITH RING ABOVE -->
<!ENTITY Aring	"&#x00C5;"> <!-- LATIN CAPITAL LETTER A WITH RING ABOVE -->
<!ENTITY atilde	"&#x00E3;"> <!-- LATIN SMALL LETTER A WITH TILDE -->
...

Error message is always "Entity &shy; not defined".

Would be very nice if at least the second example would work.

Dan

failed to located the main schema

Hi,

Exalt has recently stopped validating against my schema. I haven't noticed exactly when it stopped, I am assuming it was with a version upgrade, but can't say when. Here is an example of my xsi:schemaLocation:
xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/timeSeriesExportRun.xsd">

This used to work fine. If I remove the namespace (http://www.wldelft.nl/fews), it works fine. However, then the other tools I have like xmlspy show errors and complain about the missing namespace.

You have any ideas why this no longer works?

Thanks!

-Gabe

Validation error disappears from screen

If I select a line in an XML file that failed to validate against the XSD file, the error appears in the status bar at the bottom of the application. However, it disappears after a few seconds so I can no longer read the error. Is this expected? Are the errors logged anywhere else? Thanks

some info about catalogs

Hi, I would validate some xml comparing with my xsd.

Have I use the catalog? How coudl I configure it on Windows 10?

Thanks a lot

Shows error for CDATA entries

1. Summary

Shows error for CDATA entries but works with #PCDATA

2. Expected Behavior

Should notify "Valid markup".

3. Actual Behavior

Error : "Element lname content does not follow the DTD, expecting (CDATA), got (CDATA)"

4. Code Used

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE name [    <!ELEMENT name (fname,lname)>    <!ELEMENT fname (#PCDATA)>    <!ELEMENT lname (CDATA)> ]>
<name>    <fname>Vaibhav</fname>    <lname>Bansal</lname> </name>

5. Environment

Operating System: Windows 8.1 x64 EN
Sublime Text: Build 3126

Thanks.

[Bug] Can not begin to use issue

1. Summary

Exalt not worked for me.

2. Expected behavior

Successful validate and format XML files.

3. Actual behavior

  1. I don't see Exalt commands in command palette.

Exalt in command palette

  1. If I run exalt_validate and exalt_format_document commands, nothing occurs.

4. Steps to reproduce

The problem is reproduced for me in a version of Sublime Text without plugins and user settings.

I install Exalt via Package Control → I restart Sublime Text → I open some .xml files, for example, opensearch.xml or with_fries.xml or SashaSublime.tmTheme. I deliberately made mistakes in these files, that to see, how Exalt to work.

Ctrl+Shift+P → I print Exalt, but I not see Exalt commands in command palette. I press Ctrl+Alt+X and Ctrl+Alt+V hotkeys, but nothing occurs in my incorrect XML files.

5. Environment

Operating system and version:
Windows 32-bit 10.0.14393
Sublime Text:
Build 3126

Thanks.

[Bug] exalt_format_selections delete lines.

1. Summary

exalt_format_selections delete lines.

2. Expected behavior

Format selected code.

3. Actual behavior

Some lines of code was deleted.

4. Steps to reproduce

The problem is reproduced for me in a version of Sublime Text without plugins and user settings.

I select lines in my xml-document. Ctrl+Shift+PExalt: Format Selections → last 9 lines delete for me.

5. Environment

Operating system and version:
Windows 10 Enterprise LTSB 64-bit EN
Sublime Text:
Build 3126

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.