running executable from xml code

Discussion in 'XML' started by doneirik, Feb 15, 2007.

  1. doneirik

    doneirik Guest

    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
    doneirik, Feb 15, 2007
    #1
    1. Advertising

  2. 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.
    Tjerk Wolterink, Feb 15, 2007
    #2
    1. Advertising

  3. > 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.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Feb 15, 2007
    #3
  4. doneirik

    Peter Flynn Guest

    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">
    > &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
    --
    XML FAQ: http://xml.silmaril.ie/
    Peter Flynn, Feb 15, 2007
    #4
  5. Peter Flynn wrote:
    > 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.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Feb 15, 2007
    #5
  6. Peter Flynn wrote:

    > 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</a></b>
    > 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?

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Feb 16, 2007
    #6
  7. Tjerk Wolterink wrote:
    >
    > 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 !
    Philippe Poulard, Feb 16, 2007
    #7
  8. doneirik

    Peter Flynn Guest

    David Dorward wrote:
    > Peter Flynn wrote:
    >
    >> 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</a></b>
    >> DHR Report
    >> </resource>

    >
    > 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
    Peter Flynn, Feb 16, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. selecao
    Replies:
    0
    Views:
    568
    selecao
    Oct 19, 2006
  2. Replies:
    15
    Views:
    472
    Dave Thompson
    Aug 21, 2006
  3. pratap
    Replies:
    20
    Views:
    743
    Flash Gordon
    Mar 7, 2007
  4. Jason Cavett
    Replies:
    8
    Views:
    603
    Sanjay
    May 16, 2007
  5. Replies:
    0
    Views:
    423
Loading...

Share This Page