[
Lists Home |
Date Index |
Thread Index
]
On 5/9/05, Vladimir Gapeyev <vgapeyev@seas.upenn.edu> 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.
|