Home Forums General XMetaL Discussion Handling ID references in Xmetal Reply To: Handling ID references in Xmetal

Derek Read

Reply to: Handling ID references in Xmetal

There is no way to suppress individual validation errors while leaving the document in an invalid state so you cannot do both 1 and 2. If you wish to have option 1 then I think you will need to turn validation off entirely. See the following posting: http://forums.xmetal.com/index.php/topic,1120.0.html

The only other thing I can think of would be to modify the DTD so that the IDREF is not a true IDREF, but perhaps CDATA. In this case XMetaL will not enforce the XML IDREF rules for the attribute. Perhaps this is desireable if you wish to rely on some other system to match the two attributes? You haven't provided enough information to know that is the case, but I get the feeling you might have other systems involved here.

For option 2 do you want to completely automate this inside XMetaL Author? The user would not be involved at all? If that is the case you must be able to imagine a system that can automatically decide which ID values to match with IDREF values all by itself. I cannot imagine such a system myself, but perhaps you can. As long as specific logic can be defined then you should be able to write a script to implement it.

If the user needs to be involved to provide feedback on which ID and IDREF to match up then we probably need to think about some kind of user interface. If you can describe what that might look like I can probably make some further suggestions. However, at its simplest you would likely need to obtain a list of all IDREF values that do not have a matching ID value and display those to the user in some fashion. The user could then select either the ID or the IDREF and subsequently select its match. If some external source also needs to be involved (perhaps a database lookup or something else) then you would need to hook into that as well.

You can find a simple example that matches two elements using their attribute values in the Journalist demo:

1. Create a new Journalist document.
2. Open the “Journalist 2” toolbar.
3. Click on the “red book” icon to “Insert BiblioItem”.
4. Inside the element type some text.
5. Place your cursor inside a element.
6. Click on the “open book” icon to “Insert Citation”. You will see a dialog that lists all the elements and lets you choose between them based on the text inside each of their elements. The actual linking that is done is based on attributes. It is this last dialog and the associated code that I am suggesting you might use for inspiration.