Menu

xml modification

Help
jakir
2008-09-09
2013-04-22
  • jakir

    jakir - 2008-09-09

    Is it possible to modify an xml file (which will be part of the files to be installed) using values entered by user at installation?

     
  • vehe

    vehe - 2009-10-02

    I have the same problem. Is it possible?

    Thanx!

     
  • mmugabo

    mmugabo - 2009-10-20

    When you say "xml file which will be part of the files installed", you don't mean the antinstall-config.xml of the installer itself, right? you mean just a file of your installables….If that is the case, yes it is possible…Actually it is possible to anything you want with the inputs provided by the user, all you have to do is to add an ant task in your installer build.xml file which will take the value of the input you are interested in and just go to that file (your xml) and replace it…One thing to keep in mind here, the tasks in the installer build file are not considered to be depended to each other, in fact, if a target named "x" in your build file was not set or mentioned in your antinstall-config.xml file, it wont be called when the installer is running the build tasks. What you can do if you want to perform the change to your xml file without showing this to the user, you can define this replacemement task on your progress page and set "showTargets" to false, or have one of the target defined in the config file call your replace task right from the build file itself.. something like:

    <property file="${basedir}/ant.install.properties"/>

    <target name="definedIntheconfigxmlfile" depends="">
        <mkdir dir="${userhome}/thisisjustanexampletask" />
        <antcall target="replaceinmyxml" />
    </targert>

    <target name="replaceinmyxml" depends="">
    <replace …..bla bala…your replacement Here    />
    </target>

    There is also another way that will give you full control of the user inputs you got from the UI, but this will require you to add some other "postDisplayTarget" targets on your installer project, just like he is got the antinstaller-message and antinstaller-property  postDisplayTargets

    Hope this will help…

    mmugabo-

     

Log in to post a comment.

MongoDB Logo MongoDB