[Home] [By Thread] [By Date] [Recent Entries]

  • To: Vladimir Gapeyev <vgapeyev@s...>
  • Subject: Re: Well-established uses of processing instructions?
  • From: Mark Wilkinson <kremvax@g...>
  • Date: Wed, 18 May 2005 10:54:15 +0100
  • Cc: xml-dev@l...
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=hjQhqKaSmxjf3MYoTVIVOHKX40Xhuq/kzXfMQ4FM5TExqNd5pdOrecPgATCG5FltU+miSrHdc3nIifNhXTp09qVZFZxyy3QM3G1aNzFah/O5bByEgnc5T1D9lWPxF+0BsoLmAhhghaK9GMzqDr+orSPInAylWWPDZ+ao0IPwZGY=
  • In-reply-to: <Pine.GSO.4.58.0505081923130.20291@r...>
  • References: <Pine.GSO.4.58.0505081923130.20291@r...>
  • Reply-to: Mark Wilkinson <kremvax@g...>

On 5/9/05, Vladimir Gapeyev <vgapeyev@s...> wrote:
> 
> I am curious to know to what uses have people put XML processing
> instructions.  I am more interested in those that have a "community"
> around them (manifesting itself by a de jure or a de facto standard, or
> multiple applications that understand the PI, or large amount of document
> instances with unrelated authorship) rather than in made-up samples,
> however plausible they are.  Any pointers?

I'm a bit late to the discussion, and my example doesn't have much of
a community around it yet as the code is still in development, but I'm
considering using processing instructions as a way of switching the
expression language syntax used in (yet another) scripting language
that uses XML as its syntax. The idea is that you can write something
like this:

    <c:out value="${name.length()}"/>
    <?script-el xpath ?>
    <c:out value="${/projects/project[@name = $project]}"/>
    <?script-el ognl ?>

I could probably have used plain elements instead of processing
instructions, but to me these are instructions to the software that is
parsing the script, not part of the script itself. I could also have
encoded the information into an attribute, but attributes have more of
a tree semantic - attaching an attribute to an element suggests that
it should apply to that node and all its children ('xmlns' probably
being the canonical example). I didn't think that using tree semantics
was the right approach.

Processing instructions seem like the right approach when you're
trying to express 'out-of-band' information like this, particularly
when it isn't directly linked to the tree structure of the document.
In my example the change of expression language is something that
applies from a point in the source text onwards, a concept that is
hard to express otherwise.

-Mark.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member