File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Perl and the fly likes Replacing XML Values with XML::Simple Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Perl
Bookmark "Replacing XML Values with XML::Simple" Watch "Replacing XML Values with XML::Simple" New topic
Author

Replacing XML Values with XML::Simple

Michael Malley
Greenhorn

Joined: Oct 12, 2011
Posts: 20
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!
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 805
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

Joined: Oct 12, 2011
Posts: 20
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Replacing XML Values with XML::Simple
 
Similar Threads
StringTokenizer
Substring capture To Write A list Of instances in A New Document
SAXParseException: XML document structures must start and end within the same entity.
gettin error with TextReader
insert header and footer with POI HWPF?