Envirnoment (?) question

T

Thumain Th.

Hi,

Sorry with this strange problem.
We use XML::Simple to parse small xml files.
Program was shortened to

use strict;
use XML::Simple;
my $ref=XMLin('/var/tmp/file.xml')

On one of our systems XMLin crashes with 'illecal xml character' (file.xml
is OK).

BUT:
With perl debugger the $ref=XMLin(...) runs OK
AND:
With perl debugger if the $ref=XMLin(...) is run before typing c for
running program
the program runs OK.

We suppose something is wrong with XML module installation , but why can
the debugger
run and not program ?

Thanks for any idea.
 
S

Sherm Pendley

Thumain Th. said:
Hi,

Sorry with this strange problem.
We use XML::Simple to parse small xml files.
Program was shortened to

use strict;
use XML::Simple;
my $ref=XMLin('/var/tmp/file.xml')

On one of our systems XMLin crashes with 'illecal xml character'
(file.xml is OK).

The error you're getting says that the file is not OK. Have you used a
different tool to verify that the XML is in fact well-formed and (if it
has a DTD) valid?

sherm--
 
T

Tad J McClellan

Thumain Th. said:
On one of our systems XMLin crashes with 'illecal xml character' (file.xml
is OK).


Please copy and paste error messages rather than attempting to retype them.
 
T

Thumain Th.

The error you're getting says that the file is not OK. Have you used a
different tool to verify that the XML is in fact well-formed and (if it
has a DTD) valid?

sherm--
Yes it is , and is parsed OK under debugger.
 
T

Thumain Th.

Please copy and paste error messages rather than attempting to retype
them.
Thanks for your answer , here is 1st line of STDERR:
XML::SAX::Exception::throw('XML::SAX::Exception::parse', 'Message',
'Not a v
alid XML character: \'=\'') called at
/usr/lib/perl5/vendor_perl/5.8.6/XML/
SAX/PurePerl/Reader.pm line 92
XML::SAX::purePerl::Reader::match('XML::SAX::purePerl::Reader::Stream=ARRAY(
0x890df10)', '=') called at
/usr/lib/perl5/vendor_perl/5.8.6/XML/SAX/PurePerl/XM
LDecl.pm line 52

I did not insert error message since same program and file correctly
function on
other systems. Trying to find why on THIS system ,file parses OK under
debugger not in program with
same instructions.
 
S

sln

Yes it is , and is parsed OK under debugger.

I wouldn't think Simple requires DTD or any thing else.
In fact I know thats not the case. I don't know the default
parser Simple uses, but Simple is not in itself a parser.

I never passed it a file name. Does it do that? Usually an open file
handle is passed in leu of an xml string. Pass some junk xml string and
see if it works. Some content at root level. Try to invoke an exception.

Try these two lines:

use XML::Simple;
$XML::Simple::pREFERRED_PARSER = 'XML::parser';

I never use Simple anymore, I have my own complete package I have
written with many tools. Man that Expat though, its nightmare fast
but has got nothing else.

sln
 
T

Thumain Th.

Thanks for your answer , s
Please explain difference between 'one of' and 'our systems'.
Excellent question!
Same file and program runs OK on all our systems but not on THIS one.
THIS system is Suse 9.3 , perl 5.8.6 and old 5.000503 leaves
in/usr/local/lib/perl5/... , development
environment was migrated to this machine , perl 5.8.6 was installed and
many modules (including XML , ...)
were just copied from original /usr/local/lib/perl5/5.0000503 to same
directories (ie NOT 5.8.6) on this
system. They seem to function OK.

Other systems are RH 7.2/perl 5.000503 ,RH 6 and other linux flavors.

One of our customers runs same system as THIS and program and file run OK
on it...
Please copy-paste exact and full messages.

*CUT*


XML::SAX::Exception::throw('XML::SAX::Exception::parse', 'Message',
'Not a v
alid XML character: \'=\'') called at
/usr/lib/perl5/vendor_perl/5.8.6/XML/
SAX/PurePerl/Reader.pm line 92
XML::SAX::purePerl::Reader::match('XML::SAX::purePerl::Reader::Stream=ARRAY(
0x890df10)', '=') called at
/usr/lib/perl5/vendor_perl/5.8.6/XML/SAX/PurePerl/XM
LDecl.pm line 52

I did not insert error message since same program and file correctly
function on
other systems. Trying to find why on THIS system ,file parses OK under
debugger not in program with
same instructions.

Thanks for time spent reading posts....
 
T

Thumain Th.

]
Yes it is , and is parsed OK under debugger.

I wouldn't think Simple requires DTD or any thing else.
In fact I know thats not the case. I don't know the default
parser Simple uses, but Simple is not in itself a parser.
Right , no DTD and uses SAX
I never passed it a file name. Does it do that? Usually an open file
handle is passed in leu of an xml string. Pass some junk xml string and
see if it works. Some content at root level. Try to invoke an exception.
It works , since same program and xml file run OK on other systems or
under perl debugger.
Try these two lines:

use XML::Simple;
$XML::Simple::pREFERRED_PARSER = 'XML::parser';
Shall try it
I never use Simple anymore, I have my own complete package I have
written with many tools. Man that Expat though, its nightmare fast
but has got nothing else.

sln

Thanks.
 
E

Eric Pozharski

Thanks for your answer , s

Excellent question!
Same file and program runs OK on all our systems but not on THIS one.
THIS system is Suse 9.3 , perl 5.8.6 and old 5.000503 leaves
in/usr/local/lib/perl5/... , development
environment was migrated to this machine , perl 5.8.6 was installed and
many modules (including XML , ...)
were just copied from original /usr/local/lib/perl5/5.0000503 to same
directories (ie NOT 5.8.6) on this
system. They seem to function OK.

Oh, no... I think, you are on your own with such a mess. I (strongly)
advice to clean up and reinstall the whole environment the right way. I
haven't personal experience with mixed environments, but that's surely
doable. Post here for advice. Look, you can't "just copy", you must
*install*. You are free to go your way, but consider changing it.
Other systems are RH 7.2/perl 5.000503 ,RH 6 and other linux flavors.

One of our customers runs same system as THIS and program and file run OK
on it...



XML::SAX::Exception::throw('XML::SAX::Exception::parse', 'Message',
'Not a v
alid XML character: \'=\'') called at
/usr/lib/perl5/vendor_perl/5.8.6/XML/
SAX/PurePerl/Reader.pm line 92
XML::SAX::purePerl::Reader::match('XML::SAX::purePerl::Reader::Stream=ARRAY(
0x890df10)', '=') called at
/usr/lib/perl5/vendor_perl/5.8.6/XML/SAX/PurePerl/XM
LDecl.pm line 52

If my understanding of "Extensible Markup Language (XML) 1.0 (Fourth
Edition)" (what I have on hand), section 4.1 is correct than

'&#x' [0-9a-fA-F]+ ';'

is perfectly valid B<CharRef>. C<=> fits that spec and is out of
(even) discouraged ranges of Unicode. From POV of
/usr/lib/perl5/vendor_perl/5.8.6/XML/SAX/PurePerl/Reader.pm it's not.
Point. Either reconsider your way, or look at http://rt.cpan.org for
bugreports of B<XML-SAX> distribution (that F<Reader.pm> is of it). If
you'll find nothing promising, then read F<Changes> on
L<http://cpan.org>; yes, not local (you don't know for sure of what
version local F<Changes> are). If there won't be nothing too, then
start fixing F<Reader.pm>.

Look, if you'll go that long exciting way *and* accidentally succeed,
then you'll feel yourself a kind of superman. Just keep in mind, fixing
that particular problem doesn't solve the whole mess. You would just
delay the next hit. And it's coming, I promise.

*CUT*
 
T

Thumain Th.

I wouldn't think Simple requires DTD or any thing else.
In fact I know thats not the case. I don't know the default
parser Simple uses, but Simple is not in itself a parser.

I never passed it a file name. Does it do that? Usually an open file
handle is passed in leu of an xml string. Pass some junk xml string and
see if it works. Some content at root level. Try to invoke an exception.

Try these two lines:

use XML::Simple;
$XML::Simple::pREFERRED_PARSER = 'XML::parser';

I never use Simple anymore, I have my own complete package I have
written with many tools. Man that Expat though, its nightmare fast
but has got nothing else.

sln

Thanks a lot, it worked , Still do not understand why OK with debugger not
with program..
 
T

Thumain Th.

Le Fri, 07 Nov 2008 01:00:44 +0100, Eric Pozharski
<[email protected]> [...]
Excellent question!
Same file and program runs OK on all our systems but not on THIS one.
THIS system is Suse 9.3 , perl 5.8.6 and old 5.000503 leaves
in/usr/local/lib/perl5/... , development
environment was migrated to this machine , perl 5.8.6 was installed and
many modules (including XML , ...)
were just copied from original /usr/local/lib/perl5/5.0000503 to same
directories (ie NOT 5.8.6) on this
system. They seem to function OK.

Oh, no... I think, you are on your own with such a mess. I (strongly)
advice to clean up and reinstall the whole environment the right way. I
haven't personal experience with mixed environments, but that's surely
doable. Post here for advice. Look, you can't "just copy", you must
*install*. You are free to go your way, but consider changing it.
[...]
You are right of course , the reason is installing individual perl modules
on each
of our customers was supposed taking a long time , ....
If my understanding of "Extensible Markup Language (XML) 1.0 (Fourth
Edition)" (what I have on hand), section 4.1 is correct than
[...]
Look, if you'll go that long exciting way *and* accidentally succeed,
then you'll feel yourself a kind of superman. Just keep in mind, fixing
that particular problem doesn't solve the whole mess. You would just
delay the next hit. And it's coming, I promise.

*CUT*
Right again.
Question was **just** why XML::Simple was OK under perl debugger , and not
in progtam with
same instructions.

Thanks for your advice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top