Home Forums General XMetaL Discussion Working multiple versions of a schema with the same name Reply To: Working multiple versions of a schema with the same name

Derek Read

Reply to: Working multiple versions of a schema with the same name

If you were using a DTD then it would be best practice to create a PUBLIC ID in the XML document that contains version information and then simply provide XMetaL with a catalog file that maps the different PUBLIC ID values to SYSTEM ID (which in this case could be anywhere, including the Rules folder). But you aren't, so…

One way to do this is to move the files to the local machine and then change the schemaLocation to point to them there. You are effectively using the equivalent to a full path right now (that includes a network machine name) so this would translate to:

C:Program FilesXMetaL 6.0AuthorRulesv1foo.xac
C:Program FilesXMetaL 6.0AuthorRulesv2foo.xac

Alternatively, you can provide a scripting solution (if you don't want to or cannot mess with the paths in the XML). To do this I think you would need to create an application-level macro containing the event On_Application_Resolve_Entity

Inside that event use the following read/write properties to check for identifiable information (just throw them up in an Application.Alert first to see what it returns for your particular documents):

Application.Alert("System ID: " + Application.ResolveEntityInfo.systemID);
Application.Alert("Public ID: " + Application.ResolveEntityInfo.publicID);

In the case of an XSD there is technically no “SYSTEM ID”, however, I believe XMetaL will return the value for your schemaLocation in this case. Your logic might be similar to the following:

var currLocation = Application.ResolveEntityInfo.systemID;
...do some check using regular expression or other logic here...
var newLocation = ...modify the value somehow...
Application.ResolveEntityInfo.systemID = newLocation;

Of course, this means that what systemID initially returns has to be different for your v1 and v2 so you can tell them apart (I assume that must be the case).

Reply

Products
Downloads
Support