473,322 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Can't read from xml file

SandeepShanu
Hi,

I want to store an xml file in a var so that i can use the particular values of some nodes later.
i am using following code:

Expand|Select|Wrap|Line Numbers
  1. #!C:\Perl\bin
  2.  
  3. use XML::Simple;
  4. use Data::Dumper;
  5.  
  6. $xml = new XML::Simple;
  7. $data = $xml->XMLin('cas.xml');
  8. print Dumper($data);
But its giving error:
"File does not exist: cas.xml at xml_test.cgi line 7"

I have kept both code file & xml file at same place.
I also tried giving the absolute path "C:\test\cas.xml".

But its throwing same error.

Kindly Help.

Regards,
Sandeep
Aug 17 '10 #1
1 2895
RonB
589 Expert Mod 512MB
Always use the code tags when posting code.

Always use the strict and warnings pragmas and declare your vars with the 'my' keyword.

Double check the spelling of the filename and path.

When using the absolute path, use forward slashes instead of backslashes.

Expand|Select|Wrap|Line Numbers
  1. #!C:\Perl\bin
  2.  
  3. use strict;
  4. use warnings;
  5. use XML::Simple;
  6. use Data::Dumper;
  7.  
  8. my $xml = XML::Simple->new;
  9. my $data = $xml->XMLin('C:/test/cas.xml');
  10. print Dumper($data);
Aug 17 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

40
by: Abby | last post by:
My .dat file will contain information like below. /////////// First 0x04 0x05 0x06 Second 0x07
11
by: nick | last post by:
the following code is used to read a file called "input.txt" # include <stdio.h> int main(int argc,char *argv){ FILE *fp; int ch; fp=fopen("input.txt","r"); ch=fscanf(fp,"%d",&ch);...
2
by: Glen Conway | last post by:
Hi, I am trying to get the contents of a file in a hidden share on a remote server, something like '\\server.domain.com\c$\program files\application\document.xml'. When I try any of the...
2
by: Stan Sainte-Rose | last post by:
Hi, I need to read a kind of text file from vb.net I do know how to read a simple file, but this one seems to have special characters. Some characters appears like squares when open this file...
2
by: somequestion | last post by:
During copying file , wanna read file Size like this string CheckFileSize(string fileName) { if( fileName == null ) return; FileInfo fi = new FileInfo(fileName); return fi.Length.ToString();...
2
by: Ronald S. Cook | last post by:
Right-click on a file (e.g. a .wmv file) in Windows Explorer and there's the "General" tab with Date Created, Attributes (i.e. whether the file is read only or and.or hidden), and other properties....
1
by: colleen1980 | last post by:
Hi:Can any one please tell me how to convert excel file into a text file thru VB6 Program? Also is it possible that i read the values from the converted text file of any column one by one thru do...
2
by: xplode144 | last post by:
I have a Web application. i need to read a file once during the startup and preserve the read data throughout the life of the application. i will to access the data often during the page_load of...
2
by: jcor | last post by:
Hi, My goal is to put a file in a server trough ftp. I'm using module Net::Ftp. My code is simple (maybe too simple :-) ) #!/usr/bin/perl use Net::FTP; my $ftp_host = 'ftp.tvnet.com.pt';...
3
by: =?Utf-8?B?dHZpbg==?= | last post by:
Hi All, I'm working with an application that read CSV File and populate data into Datatable. but unfortunatly CSV file change to .BRF file, they are completly different. So is someone...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.