running executable from xml code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • doneirik

    #1

    running executable from xml code

    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.atla ssian.jira.plug in.issueoperati on.DefaultPlugg ableIssueOperat ion">
    <resource type="velocity" name="view">
    &lt;img src="$req.conte xtPath/images/icons/bullet_creme.gi f" height=8
    width=8 border=0 align=absmiddle &gt;
    &lt;b&gt;&lt ;a href="$req.cont extPath/secure/ConfigureReport .jspa?
    selectedProject Id=${issue.getP roject().getStr ing('id')}
    \&amp;reportKey =com.atlassian. jira.plugin.rep ort.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

  • Tjerk Wolterink

    #2
    Re: running executable from xml code

    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.

    Comment

    • Joe Kesselman

      #3
      Re: running executable from xml code

      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

      Comment

      • Peter Flynn

        #4
        Re: running executable from xml code

        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.conte xtPath/images/icons/bullet_creme.gi f" height=8
        width=8 border=0 align=absmiddle &gt;
        &lt;b&gt;&lt ;a href="$req.cont extPath/secure/ConfigureReport .jspa?
        selectedProject Id=${issue.getP roject().getStr ing('id')}
        \&amp;reportKey =com.atlassian. jira.plugin.rep ort.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.conte xtPath/images/icons/bullet_creme.gi f" height="8"
        width="8" border="0" align="absmiddl e">
        <b><a
        href="$req.cont extPath/secure/ConfigureReport .jspa?selectedP rojectId=${issu e.getProject(). getString('id') }&amp;reportKey =com.atlassian. jira.plugin.rep ort.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/

        Comment

        • Joe Kesselman

          #5
          Re: running executable from xml code

          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

          Comment

          • David Dorward

            #6
            Re: running executable from xml code

            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.conte xtPath/images/icons/bullet_creme.gi f" height="8"
            width="8" border="0" align="absmiddl e">
            <b><a
            >
            href="$req.cont extPath/secure/ConfigureReport .jspa?selectedP rojectId=${issu e.getProject(). getString('id') }&amp;reportKey =com.atlassian. jira.plugin.rep ort.example.dhr _report%3Adhr_r eport">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

            Comment

            • Philippe Poulard

              #7
              Re: running executable from xml code

              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




              --
              Cordialement,

              ///
              (. .)
              --------ooO--(_)--Ooo--------
              | Philippe Poulard |
              -----------------------------

              Have the RefleX !

              Comment

              • Peter Flynn

                #8
                Re: running executable from xml code

                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.conte xtPath/images/icons/bullet_creme.gi f" height="8"
                >width="8" border="0" align="absmiddl e">
                > <b><a
                >>
                href="$req.cont extPath/secure/ConfigureReport .jspa?selectedP rojectId=${issu e.getProject(). getString('id') }&amp;reportKey =com.atlassian. jira.plugin.rep ort.example.dhr _report%3Adhr_r eport">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

                Comment

                Working...