doneirik wrote:
Dear Group,
I do not know any XML, however, I probably need to use it...
Working on a plugin in Jira, I have an example opening a link using
the "href" command. Instead of opening a link, I would like to run a
script command (e.g. pdflatex or latex) in th xml code.
Any tips as to how I could do that?
You can't get XML itself to cause something to execute because XML is a
markup language, not a programming language.
You may be able to get your XML processor to perform this task, though,
based on finding something in your XML markup to trigger it.
<resource type="velocity" name="view">
<img src="$req.contextPath/images/icons/bullet_creme.gif" height=8
width=8 border=0 align=absmiddle>
<b><a href="$req.contextPath/secure/ConfigureReport.jspa?
selectedProjectId=${issue.getProject().getString(' id')}
\&reportKey=com.atlassian.jira.plugin.report.e xample.dhr_report
%3Adhr_report">DHR</a></b> DHR Report
</resource>
Your problem is that that has no meaning. Something or someone has
deliberately crippled the data by representing the HTML markup as
character data, and deliberately broken what remains by omitting the
quotes around attribute values, so it is not reliably accessible to an
XML processor.
It ought to read:
<resource type="velocity" name="view">
<img src="$req.contextPath/images/icons/bullet_creme.gif" height="8"
width="8" border="0" align="absmiddle">
<b><a
href="$req.contextPath/secure/ConfigureReport.jspa?selectedProjectId=${issue.get Project().getString('id')}&reportKey=com.atlas sian.jira.plugin.report.example.dhr_report%3Adhr_r eport">DHR</a></b>
DHR Report
</resource>
Now at least your XML processor can gain control over the markup and
decide what to replace with what in order to generate the output you need.
"Get the data model right to start with, and everything else pretty much
falls into place. Get it wrong to start with, and the project is hosed
before you begin." I forget who said that.
The easiest way to make it run an external binary is to write a stub
that performs that task, and add it to the repertoire of functions for
whatever your processing language is.
Depending on what you want it to do (embed the pdflatex output as an
image?) you could play dirty tricks if the output is going to be used in
a browser: transform the anchor element into an img element whose src
attribute is actually the URI of a little server script you write to run
pdflatex on whatever it is needs doing and return the result with the
correct MIME Content-Type.
///Peter
--
XML FAQ:
http://xml.silmaril.ie/