473,378 Members | 1,389 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,378 software developers and data experts.

Problem with Parsing XML file with "."

Hi, I am using XML::Simple to parse the XML file that XML file contains the "." in some of its tags.

But while executing the script i am getting the error from Perl Script like "Use of uninitialized value in concatenation (.) or string".

I am aware of that this is because of the "." which is the concantation operator in Perl. But i want to parse the XML file without making nay chnages to it.
Sep 24 '07 #1
4 1854
numberwhun
3,509 Expert Mod 2GB
Hi, I am using XML::Simple to parse the XML file that XML file contains the "." in some of its tags.

But while executing the script i am getting the error from Perl Script like "Use of uninitialized value in concatenation (.) or string".

I am aware of that this is because of the "." which is the concantation operator in Perl. But i want to parse the XML file without making nay chnages to it.

Why not post a sample of the data you are working with and also, in order to assist you, we will definitely need you to please post the code that you are working on. (placed in code tags please, as per the REPLY GUIDELINES to the right of the Message window when replying).

Once we have that, we can try to assist in your troubleshooting.

Regards,

Jeff
Sep 24 '07 #2
Hi as you informed i am posting the code here..

This is my Perl Code

use strict;
use XML::Simple;
use Data::Dumper;
my ($FILENAME, $Parser);
$FILENAME = "C:\\PerlScript\\Master.xml";
$Parser = XMLin($FILENAME);

print " $Parser->{properties}->{property}->{NCHOME.INSTALLDIR}->{value}\n";


This is the XML File
<?xml version="1.0" ?>
- <CommonInstaller version="1.0">
- <properties>
<property name="NCHOME.INSTALLDIR" value="[$NCHOME]" />
<property name="LICENSESERVER.HOST" value="localhost" />
<property name="LICENSESERVER.PORT" value="27000" />
</properties>
</CommonInstaller>


This is the Error i am getting while execute the Perl Scipt
Use of uninitialized value in concatenation (.) or string
Sep 25 '07 #3
By using the DataDumper the content of the XML file is displying properly. But when i try to extract an element indepedently it thwos the above ERROR
Sep 25 '07 #4
KevinADC
4,059 Expert 2GB
The problem is the hash key:

{NCHOME.INSTALLDIR}

because it contains a dot you have to quote it:

{'NCHOME.INSTALLDIR'}


the error message has nothing to do with the dot in the hash key or the dots in the xml file. That is a generic error message you get when warnings are turned on and you try and print a variable that has not been initialized.
Sep 25 '07 #5

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

Similar topics

2
by: MistralZ | last post by:
Hi all! I am using Oracle XML parser ver 9.0.1.0.0 for C++ and I am having a strange problem with quotes. Parser throws a parsing error when trying to parse attributes containing quotes (even...
3
by: David Walker | last post by:
Hi, I have an XML file created by a third party in which an element with a simple content model has a text value consisting of 2 parts separated by a colon, like this ...
4
by: samadams_2006 | last post by:
Hello, I have a peculiar problem that I'm hoping someone can help me out with. I have a simple enough Web Application written in VB.Net via Visual Studio 2003. It simply displays a Web Form...
27
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set...
12
by: Julian | last post by:
Hi, I am having problems with a function that I have been using in my program to read sentences from a 'command file' and parse them into commands. the surprising thing is that the program works...
18
by: Steven Borrelli | last post by:
Hello, I am using the <?php include() ?statement on my website for organizational purposes. However, one of my includes contains some PHP code. Is there any way for the server to actually...
7
by: souravmallik | last post by:
Hello, I'm facing a big logical problem while writing a parser in VC++ using C. I have to parse a file in a chunk of bytes in a round robin fashion. Means, when I select a file, the parser...
3
by: jariwaladivyesh | last post by:
Hi frnds, i have simple XML doc <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <data> <name> Divyesh Jariala</name> </data>
0
by: bruce | last post by:
Hi Fredrick Thanks for the reply. But since I don't have control of the initial text, is there something with python that will strip/replace this... or are you saying I should do a...
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...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.