morbac / xmltools

XML Tools plugin for Notepad++
GNU General Public License v3.0
260 stars 57 forks source link

Generates PluginsManager::runPluginCommand Exception error #99

Closed Gitoffthelawn closed 3 years ago

Gitoffthelawn commented 3 years ago

I'm fixing a large commercial website, and as part of the debugging process, I'm validating some of the server responses. I've isolated an error where their servers are responding with erroneous data.

I was trying to look at some of that data in Notepad++ with your helpful extension. Unfortunately, when using the extension to format the data, the extension causes Notepad++ to issue this error:

**PluginsManager::runPluginCommand Exception error**

This should not happen.. please get in touch with the developers @ https://github.com/morbac/XMLTools

So here I am, getting in touched with you as requested! :)

Here is a tiny fragment of data that will always cause this error to appear when using both the Pretty print and Linearize functions in XMLTools:

<svg version=\"1.1\"\n\txmlns=\"http://www.w3.org/2000/svg\"\n\txmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"none\">\n\t<defs>\n\t\t<g id=\"foo\">\n\t\t\t<g fill=\"none\" fill-rule=\"evenodd\">\n\t\t\t\t<path stroke=\"#fff\" d=\"M1\" transform=\"translate(2 2)\"/>\n\t\t\t\t<path stroke=\"#fff\" d=\"M2\" transform=\"translate(2 2)\"/>\n\t\t\t\t<path fill=\"#fff\" d=\"M3\" transform=\"translate(2 2)\"/>\n\t\t\t</g>\n\t\t</g>\n\t\t</svg>

Of course, this data has serious issues (which is why their website has issues), but I don't think XMLTools should be abending when it encounters erroneous code.

morbac commented 3 years ago

Hi,

The error you encountered is sent by the SimpleXml formater engine whose I'm not the developer. You can avoid this error by using another formating engine : go in XMLTools Options and select "QuickXml" or "StringXml" as formating engine. image

Now, this will not magically make your xml valid and the syntax errors present in your part will make the formating engine unable to understand the xml structure (since it's not syntaxically valid). The engine will try to beautiful the code the best it can, but it will probably not be perfect.

Gitoffthelawn commented 3 years ago

Thanks. I will give your recommendation a try. Since SimpleXml generates an error on syntactically invalid XML, I wonder if either QuickXml or StringXml would be a better default for your plug-in. What's your thought on that?

BTW, if you can briefly summarize the key differences between the 3 engines, I'm interested in reading what you write.

morbac commented 3 years ago

The options dialog already gives some infos about these 3 engines. Briefly:

Gitoffthelawn commented 3 years ago

Thanks! What do you mean by "change the structure"? I imagine you agree that changing the actual XML would not be good! :)