xmltools icon indicating copy to clipboard operation
xmltools copied to clipboard

Specifying the DTD path

Open Brig9902 opened this issue 2 years ago • 12 comments

In my XML files, the path to the DTD has to be specified in Unix format (so that other tools will work properly); for example, “/net/srvr99/data/…”. XML Tools doesn’t seem to recognize that path format, it seems to require standard Windows format (e.g., “M:\…”). Is there a way to tell XML Tools to ignore the path in the files and use a different one?

Brig9902 avatar Mar 08 '22 16:03 Brig9902

Do you really want it to ignore the path, or simply convert forward slashes to backslashes?

Gitoffthelawn avatar Mar 09 '22 03:03 Gitoffthelawn

Well my initial thought was to see if XML Tools could ignore the path in the files and use one I specify. The form in the files is Unix: "/net/srvr_/data/projects/dtd_/Schemas_folder/document.xsd" The path that XML Tools likes is Windows: "M:\projects\dtd_\Schemas_folder\document.xsd" So it's not just converting the slashes. What do you think?

Brig9902 avatar Mar 09 '22 14:03 Brig9902

You can use url format. Instead of M:\projects\dtd_\Schemas_folder\document.xsd, enter file:M:/projects/dtd_/Schemas_folder/document.xsd or file:/projects/dtd_/Schemas_folder/document.xsd

morbac avatar Mar 13 '22 09:03 morbac

Sorry, you misunderstood me. The Unix path in each file has to stay that way (there are other processes the files go through that require it). I was wondering if XML Tools could have an option of using either the path declared in the files or a path specified in, say, the plug-in's options--a global/default path (in an acceptable form).

Brig9902 avatar Mar 14 '22 13:03 Brig9902

Mmmh this looks very specific. I'm trying to find something that would be useful to others users too. I am trying to think to a solution based on a work directory that could be defined in options, but I'm not even sure it would help since you would have to enter path relatively... Other idea ?

morbac avatar Mar 18 '22 19:03 morbac

I was afraid this might be too specific to my needs. I'm not a software developer, I don't know what goes on under the hood. I was imagining an option whereby if the user specifies a path to a DTD file, that is the path/file against which the open file would be validated--regardless of what's declared in the file. If the user doesn't specify a path in this option, then the path declared in the file would be used. Easy to imagine, not so easy to implement, I'm sure. Maybe it's impossible.

Brig9902 avatar Mar 18 '22 20:03 Brig9902

We can imagine that an option "Always prompt for schema/dtd" might do the job : when enabled, the xsl/dtd selection dialog would allways open on validation and override the inline declaration. Do you think it would be ok ?

morbac avatar Mar 22 '22 20:03 morbac

So, if enabled, when I click the toolbar button to validate the open file I will be presented with a dialog that will ask for the path to the dtd, correct? Can that dialog be automatically populated with the path? Can it remember the path?

Brig9902 avatar Mar 23 '22 15:03 Brig9902

The dialog is only hidden, therefore it contains previous path when re-opened. But it won't link path to current file, nor remember path between NPP instances.

morbac avatar Mar 31 '22 20:03 morbac

From your last comment it sounds like you're working on something. How's it going?

Brig9902 avatar Apr 06 '22 15:04 Brig9902

Something is on the road, but there is still lot of work. In order to override inline schema, I must remove the schemaLocation or noNamespaceSchemaLocation, but there are some complications:

  • I cannot simply remove theses attributes because it would change elements positions, and position references in errors would be wrong afterwards
  • I must be sure that I'm removing correct attribute, i.e attribute having prefix corresponding to http://www.w3.org/2001/XMLSchema-instance namespace
  • In order to be generic, I must be able to remove DTD declaration too
  • All this must be performed without duplicating whole xml in memory in order to avoid memory overflow on large xml files

As you can see, there are some challenge and I'm quite busy these days, so I have no idea when it will be finished. Maybe not before weeks.

morbac avatar Apr 06 '22 20:04 morbac

No worries. I can work around the issue. And if you think the usefulness of this option doesn't extend to anyone but me, feel free to say so and stop working on it. I asked for it with no idea what it would entail. XML Tools is a great plugin as is.

Brig9902 avatar Apr 06 '22 20:04 Brig9902