microsoft / XmlNotepad

XML Notepad provides a simple intuitive User Interface for browsing and editing XML documents.
https://microsoft.github.io/XmlNotepad/
MIT License
966 stars 206 forks source link

Location of Schema used for current xml file unclear #368

Open minstreldragon opened 4 months ago

minstreldragon commented 4 months ago

I am working with a standard that has quite a few revisions of its Schema: AUTOSAR (autosar.org)

When opening an ARXML file in XML Notepad the tool shows me the auto completion and does on-the-fly verification. However, it is not clear to me which exact schemal version i.e. xsd file XML Notepad is using: While I see one version in the View/Schemas... dialog, this is sometimes clearly not the revision of the schema that is used internally: the two schema revisions have different elements, and I get elements in the auto-completion for my xml file that are not present in the schema revision that is indicated in the View/Schemas dialog).

Is XML Notepad buffering schemas in the background, or pulling them from the registry or something like this? If yes, what is the logic behind this?

In particular it would be good if XML Notepad would support the following use cases: (1) I want to provide XML Notepad with the exact schema file I want to use when editing an xml file. (2) I want to have an indication somewhere in the program of which exact schema file is currently being using.

Thank you for this tool. I have been using it for years, and I am generally very happy with it. However, the schema issue described keeps giving me trouble.

lovettchris commented 4 months ago

Hi Markus, thanks for your question. If you can provide a simple reproducable set of XML and XSD files so I can debug this problem that would help.

To answer your questions:

  1. XML notepad is not buffering schemas anywhere, but it does remember schemas it has seen before in the Settings.xml file, so you could try and edit that file and remove all past schemas it has listed there, or select File/Clear menu item from the Schemas... dialog.
  2. XML notepad will honor the schema specified in the xsi:schemaLocation attribute first, then it matches by XML namespace to any previously seen schema. If there are multiple versions of the schema with the same namespace, then there is no guaranteed order in which it will pick a matching schema (it's a hashtable).
  3. Good idea, I will add this feedback in the Schema dialog so you can see which schemas are being applied and perhaps provide a UI so you can change that decision.

Glad you like the tool, Cheers.