running executable from xml code

D

doneirik

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?

parts of the code:

<issue-operation key="google-summary" name="Google this issue"

class="com.atlassian.jira.plugin.issueoperation.DefaultPluggableIssueOperation">
<resource type="velocity" name="view">
&lt;img src="$req.contextPath/images/icons/bullet_creme.gif" height=8
width=8 border=0 align=absmiddle&gt;
&lt;b&gt;&lt;a href="$req.contextPath/secure/ConfigureReport.jspa?
selectedProjectId=${issue.getProject().getString('id')}
\&amp;reportKey=com.atlassian.jira.plugin.report.example.dhr_report
%3Adhr_report"&gt;DHR&lt;/a&gt;&lt;/b&gt; DHR Report
</resource>
<!-- the relative order of operations -->
<order>10</order>
</issue-operation>

best regards
 
T

Tjerk Wolterink

doneirik schreef:
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.

XML is a dataformat not a executable language....
So no this is not possible.
 
J

Joe Kesselman

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.

That's a matter of how you configure and/or script the tool that's
manipulating the XML.
 
P

Peter Flynn

doneirik said:
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">
&lt;img src="$req.contextPath/images/icons/bullet_creme.gif" height=8
width=8 border=0 align=absmiddle&gt;
&lt;b&gt;&lt;a href="$req.contextPath/secure/ConfigureReport.jspa?
selectedProjectId=${issue.getProject().getString('id')}
\&amp;reportKey=com.atlassian.jira.plugin.report.example.dhr_report
%3Adhr_report"&gt;DHR&lt;/a&gt;&lt;/b&gt; 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.getProject().getString('id')}&amp;reportKey=com.atlassian.jira.plugin.report.example.dhr_report%3Adhr_report">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
 
J

Joe Kesselman

Peter said:
You can't get XML itself to cause something to execute because XML is a
markup language, not a programming language.

Actually, XML isn't even that -- XML is a markup *syntax* which is used
as a basis for application-specific languages.

There are programming languages based on XML -- XSLT is one example --
but that's a particular use of XML and you need to run them through a
tool that actually understands them as programs before they do anything.
 
D

David Dorward

Peter said:
Your problem is that that has no meaning. Something or someone has
deliberately crippled the data by representing the HTML markup as
character data,
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.getProject().getString('id')}&amp;reportKey=com.atlassian.jira.plugin.report.example.dhr_report%3Adhr_report">DHR said:
DHR Report
</resource>

Except that that:

(a) Isn't well formed (there is no end tag for the img element, b element or
a element.

and

(b) If you want to include HTML markup in some XML language then why not use
XHTML and properly namespace it?
 
P

Philippe Poulard

Tjerk said:
XML is a dataformat not a executable language....
So no this is not possible.

the datas that you write in XML can be a program, that you can execute

Look at XSLT or Jelly

I designed and implemented a framework that allow you to run XML tags in
batch or in web applications, and to design your own tag library either
by mapping your tags to a java class or to describe them with other tags
(like a macro)

Moreover, it is also possible to design runnable declarative libraries,
and if you are smart enough, you will be able to mix imperative
constructs with declarative sentences

http://reflex.gforge.inria.fr/tutorial.html
http://disc.inria.fr/perso/philippe.poulard/xml/active-tags/

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !
 
P

Peter Flynn

David said:
Except that that:

(a) Isn't well formed (there is no end tag for the img element,

Quite right, my fault for doing it late at night.
b element or a element.

Actually there is, if you scroll right far enough :)
and

(b) If you want to include HTML markup in some XML language then why not use
XHTML and properly namespace it?

True, but I thought the user had enough to be going on with :)

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top