NOTE: Problem solved but please read ikegami's response below. Terrifically informative, especially the link about avoiding XML::Simple.
I just started working with a corporation that make extensive use of XML::Simple and we are now having parsing issues.
Here's a sample XML file... ( note first part commented out )
<xyz:CostFee>
<ec:OPA>25.00</ec:OPA>
<ec:CTID>278421</ec:CTID>
<xyz:CDEPSID>82</xyz:CDEPSID>
<ec:IID>8765654</ec:IID>
</xyz:CostFee>
I am using this simple perl script ....
#!/usr/bin/perl
use XML::Simple;
use Data::Dumper;
my $content = XMLin('./data.xml');
print Dumper($content);
Running the script yields this.....
Undeclared prefix: xyz at /System/Library/Perl/Extras/5.18/XML/NamespaceSupport.pm line 298.
XML::Simple called at ./xml_test.pl line 6.
When I use this in the XML file...
<catalog>
<part partnum="184324" desc="Desc 1" price="19.00" />
<part partnum="765398" desc="Desc 2" price="18.00" />
<part partnum="878998" desc="Desc 3" price="15.00"/>
</catalog>
It works just fine and Dumper happily dumps it out.....
Since we are talking about a legacy program and replacing XML::Simple isn't desired ( but honestly I don't think you can register a namespace in XML::Simple but I am by no means an expert ).
Can anyone point me in the right direction with a pointer or two? I am thinking that including namespace info as part of the XML content might be the way to go, something like......
<xsl:stylesheet version="1.0" xmlns:xsl="https://www.w3.org/1999/XSL/Transform">
Many thanks JW