Tim Larson wrote:
> On Wed, Feb 02, 2005 at 10:35:03AM +1300, Conal Tuohy wrote:
> > > Tim Larson wrote:
> > > > As part of my effort to keep whiteboard/forms mergeable,
> <snip/>
> > > >Could we pick a style, and then I will make the files I
> > > >happen to touch match it?
> >
> > What about a processing instruction?
> > <?version $Id$?>
> >
> > This has the advantage over a comment that it can be
> retrieved unambiguously with an XPath query:
> > "processing-instruction('version')"
>
> I like the ability to retrieve the Id info...not knowing
> much about processing instructions, will this produce
> valid processing instructions when the version control
> system expands $Id$? This expands into lots of stuff:
> datestamp, filename, submitter, etc.
So long as it doesn't include the string "?>" it will be OK.
> Also, can this mess up any existing document processing?
It shouldn't. Most XML software should be happy to ignore processing
instructions (unless the pi is targeted at them), just like with comments.
In the SAX pipeline, the processing instructions are passed using a
"processingInstruction" method, so completely independently of
startElement/endElement/characters/etc. Typically, pipeline components will
inherit a "processingInstruction" method from a superclass, which will do
nothing.
Cheers
Con