All,

Any help regarding below problem is greatly appreciated.
My intention is to change value to true.

<javaTask className = "tool.update.languagepack.MergeConfig">
                <arg name="sample" value="false"/> 

                        to 

   <javaTask className = "tool.update.languagepack.MergeConfig">
                <arg name="sample" value="true"/>        


Thanks,
Ravi


-----Original Message-----
From: Ravinder Arepally 
Sent: Monday, June 07, 2004 5:56 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: XML::DOM::Parser question !

All,
 
I am trying to parse a XML file and change an element value. 
Below is code of mine where I am doing this. However, setAttribute doesn't
work and it doesn't give any error message too.
I spent enough time and doesn't make sense to me. I get right value using
getAttribute('value).
XML file is also pasted at the end of this mail. Any help or pointer is
greatly appreciated. 
Any suggestions in writing better code for this task is also appreciated.
 
Thank you,
Ravi.
 
---------------------------------------------------
my $udtTaskFile =
"$depotLocation/updates/$udtBaseName/tasks/$udtBaseName"."_cs_udt.xml";
 print ("udtTaskfile is : $udtTaskFile \n");  ------- XML file which is
pasted at end of this mail.
 Util::safeCopy("$udtTaskFile", "$udtTaskFile".time()); -- I have Util.pm 
 
 my $parser = new XML::DOM::Parser;
 my $doc = $parser->parsefile($udtTaskFile);
 
 my @taskList = $doc->getElementsByTagName('taskEntry');
 
 foreach my $task (@taskList) {
     if ($task->getAttribute('uniqueName') eq "MergeConfig"){
          my $javaTask = $task->getElementsByTagName('javaTask');
          if (! $javaTask) {
              $log->write("ERROR: Couldn't find any Java tasks in
$udtTaskFile ");
             return "Problem configuring installLPI. Couldn't find any Java
Tasks in $udtTaskFile. ";
          }
      my $innerTask = $javaTask->item(0)->getElementsByTagName('arg');
      if (! $innerTask) {
              $log->write("ERROR: Couldn't find any languagepack tasks in
$udtTaskFile ");
             return "Problem configuring installLPI. Couldn't find any
languagepack Tasks in $udtTaskFile. ";
      }
      my $value = $innerTask->item(0)->getAttribute('value');
      print ("value is 333333333333 $value \n");      -------- This prints
right value
      $innerTask->item(0)->setAttribute('value', "true");  ----- This is not
working. No error and it doesn't change value
     }
 }
 
 
----------------------------------------------------------------------------
------------------------------
 
 
 
<!DOCTYPE harnessTaskList SYSTEM "harnessTaskList.dtd">
   <harnessTaskList extensionClassname = "tools.update.TaskHarnessExtForUDT"
                    logCategory = "update/info">
        <!-- Task UDT
               Runs the update delivery tool
        -->
        <taskEntry uniqueName   = "DiskSpace"
                   description  = "Checks if the necessary space is
available on disk to proceed with update"
                   logCategory  = "update/info"
                   canRerun     = "true">
            <javaTask className = "tools.update.DiskSpace"/>
        </taskEntry>
        <taskEntry uniqueName   = "UDT"
                   description  = "Runs the update delivery tool"
                   dependency   = "DiskSpace"
                   logCategory  = "update/info"
                   canRerun     = "true">
            <javaTask className = "tools.update.UpdateDeliveryTool"/>
        </taskEntry>
        <taskEntry uniqueName   = "EnableLanguages"
                   description  = "Install files for language pack."
                   dependency   = "UDT"
                   canRerun     = "true"
                   logCategory  = "lpi/info">
            <javaTask className =
"tool.update.languagepack.EnableLanguage"/>
        </taskEntry>
        <taskEntry uniqueName   = "MergeConfig"
                   description  = "Merges language related files to config."
                   dependency   = "UDT, EnableLanguages"
                   logCategory  = "lpi/info"
                   canRerun     = "true">
            <javaTask className = "tool.update.languagepack.MergeConfig">
                <arg name="sample" value="false"/>          --------------
This is the value I am trying to change
            </javaTask>
        </taskEntry>
</harnessTaskList>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to