Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Replacing XML Values with XML::Simple

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I've got a program that deals with both a word doc and an XML file. It uses Win32::OLE and XML::Simple. The XML file provides search strings to find in the word doc. When the search string is found, it's sister node, "value" needs to be changed from 0 to 1. I've read up on XML::Simple, but I'm not seeing where I'm going wrong here. Basically, in the section where I find the search string, it works, and I find the string, but I can't change the value node's value. The code where this is done is below:



XML DATA:
<?xml version='1.0'?>
<skills>
<skill>
<type>J2EE</type>
<value>0</value>
</skill>
<skill>
<type>SAN</type>
<value>0</value>
</skill>
<skill>
<type>Cisco</type>
<value>0</value>
</skill>
<skill>
<type>OPNet</type>
<value>0</value>
</skill>
</skills>

Thanks in advance!
 
Ranch Hand
Posts: 838
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You printed out the object using Dumper, could you run again with the Dumper print before and after the loop and also leave the prints in for where the string match is being done (to ensure the matches are occuring)? I don't know if I'll see the problem but I can certainly lend a second set of eyes. :-)
 
Michael Malley
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Hunter wrote:You printed out the object using Dumper, could you run again with the Dumper print before and after the loop and also leave the prints in for where the string match is being done (to ensure the matches are occuring)? I don't know if I'll see the problem but I can certainly lend a second set of eyes. :-)



Rob, thanks for your input on this. I actually decided to go a different way altogether, and didn't use XML::Simple. But thanks again.
 
reply
    Bookmark Topic Watch Topic
  • New Topic