I don't see much about best practices for processing instruction, so I
was hoping to tap the xml-dev list wisdom on this issue. My question goes a
little bit beyond what Elliotte has written about in Effective XML.
We have a situation where we need to add a new capability to the MusicXML
language. This would best be handled by added a new feature to the MusicXML
DTD, but we have customers who need its right now and cannot wait
for MusicXML 1.2. So the best choice seems to be to add a processing
instruction to the MusicXML 1.1 output. The feature is really simple,
so a PI lets us add the new feature while keeping the document
valid and adding little parsing overhead.
The XML spec says "The PI begins with a target (
PITarget ) used to identify the
application to which the instruction is directed." But in our case, we
are targeting any MusicXML application that cares about this particular
feature. Should we just use the name of the feature instead? If we do that,
then matching the target name will convey all the necessary information, and
there will be no extra PI data required.
This is sort of the approach that's used in many of the processing
instruction examples in Elliotte's Effective XML book. But that section is
more addressing the question of when to use processing instructions rather
than the choice of target name. If there are any other best practices writeups
related to this topic, please let me know. Most of the others seem to be
variations of "avoid processing instructions if possible." I agree and
have avoided them for 6 years, but in this case I see no better choice.
Thank you in advance for any advice you can offer!
Best regards,
Michael Good
Recordare LLC