General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › Problems with toolbars
-
eamick April 29, 2013 at 6:25 pm
Problems with toolbars
April 29, 2013 at 6:25 pmParticipants 2Replies 3Last Activity 9 years, 11 months agoI am trying to add buttons to a toolbar in XMetaL 7.0, and I want to use macros in an mcr file. The name of the file appears in the list of categories, but when I click on the macro file name, it displays “there are no
macros”. There are macros present. What is going on? Derek Read April 29, 2013 at 8:57 pm
Reply to: Problems with toolbars
April 29, 2013 at 8:57 pmPossibly some issue with the MCR file?
What happens if you switch to the Journalist customization (File > New > Journalist tab > Article template) then try to do the same thing there? You should see the same as my attached screenshot.
Note: You didn't provide much info in your question so I might have completely misunderstood your issue.
eamick April 30, 2013 at 1:06 pm
Reply to: Problems with toolbars
April 30, 2013 at 1:06 pmI think I'd better start over. We are porting some customizations from 4.6 to 7.0. There are thousands of XML files already created that have the following doctype declaration:
This will obviously no longer work, and the prospect of changing all those files terrifies me. I tried including the following entry in extid.map:
! .*bioguide.dtd “bioguide.dtd”
The files display properly, but the toolbar buttons that call macros in bioguide.mcr are grayed out. I next switched to this:
! .*bioguide.dtd “file://c:/program%20files/xmetal%207.0/author/rules/bioguide.dtd”
When I create a new file, the toolbar buttons are active, but any attempt to open an existing file gets an error about not being able to find the DTD. We have the DTD on the Web, so I tried specifying that instead of the file:// in the entry, but I got the same result. The existing files are not on the same machine as the one I'm running XMetaL on, and there's no way to put them on the same machine, at least not permanently. It almost makes me think the pattern in the extid.map file isn't matching because of the whitespace in the value for the system ID in the existing files. (The system ID value for newly created files has no whitespace in it.) Do you have any suggestions?
Derek Read April 30, 2013 at 10:24 pm
Reply to: Problems with toolbars
April 30, 2013 at 10:24 pmThe buttons are greyed out probably because the MCR file is not being loaded because it cannot be found. That either means the DTD is not being found (in which case the entire customization is not being loaded) or just the MCR file. There are many ways to resolve this, so it is difficult to say which you should opt for. However, the simplest is to have all customization files (DTD, CSS, CTM and MCR) in the same folder and make sure the DTD is being located.
Now might be a really good time to bite the bullet and update your XML files to use a more robust DOCTYPE declaration and get rid of the hard coded full paths. If your files include a PUBLIC id in addition to the SYSTEM id then you could use a catalog file and that would allow you to place your DTD anywhere you like.
Then all you need is the following entry in XMetaL's catalog file which is in the Rules subfolder:
PUBLIC "your own standardized public id" "C:somepathbioguide.dtd"
However, you can also opt to simply place your customization files (DTD, CSS, CTM and MCR) into the Rules subfolder instead and not make any catalog changes. In that case XMetaL will check the current folder (SYSTEM portion of the DOCTYPE declaration states it is in the same folder as the XML file: “bioguide.dtd”) it won't find it there (make sure you don't have a copy there) so that will fail, XMetaL then checks the catalog files, failing to find a PUBLIC id match the final fallback is to check for the DTD in the Rules subfolder.
All of that will future proof things in general (and also make your files more readily usable with other validating XML parsers in case you opt to use any in the future).
If you really don't want to change your files then manually recreate the following path on each machine and put your DTD, MCR and other customization files in there:
c:program filesblast radiusxmetal 4.6authorrulesbioguide.dtdAnother option would be to put your customization elsewhere but use the event macro On_Application_Resolve_Entity in an application-level macro file to swap the SYSTEM id value in the XML file with another one (in memory). I think that would be overkill for this situation though.
Yet another solution would be to create a macro that changes each file (using FSO and JScript string manipulation or another XML parser such as MSXML) just before it is opened if it meets certain criteria (namely that it is a file with that DOCTYPE that you want to alter). The event that would let you do that is On_Application_Before_Document_Open. Again, that seems like overkill to me. A far better solution (provided all your files are on disk somewhere) would be to process them all at once (after backing up of course) using a batch process with a text editor (to keep things simple) that has a powerful enough find and replace utility, such as Notepad++ or similar. Such a find and replace would probably take only a couple of minutes with Notepad++ if all your files are located near each other on the same drive.
Finally, make sure your MCR file is named bioguide.mcr (unless it is an application-level macro file in which case the name does not matter provided it has an MCR extension).
A few years ago I gave a webinar called “Deploying schemas and XMetaL Customization Files” on the topic of how XMetaL locates a DTD/XSD and associated customization files (this information is documented but there are so many possibilities and the information is somewhat fragmented across the Customization Guide, the Programmers Guide and XMetaL Author's help). The webinar failed to record properly so is unavailable (no big loss) but the slides are available here:
http://www.slideshare.net/XMetaL/deploying-schemas-and-xmetal-customization-filesSee slide 8 for a diagram that should make your options pretty clear (the rest of that document will also be very useful to you).
-
AuthorPosts
- You must be logged in to reply to this topic.