Re: Xerces-P AttributeList problem

Bob Arthur <[email protected]>
Newsgroups gmane.text.xml.xerces-p.devel
Message-ID <[email protected]>
Tut tut - replying to oneself ;-)


Bob Arthur wrote:
> Hi,
> 
> I've recently compiled Xerces-C 2.3.0-1, and XML-Xerces-2.3.0-4.  I'm
> using Debian woody. (g++ version 3.0.4)

Forgot to mention that I'm using perl 5.6.1.

> All was going well, but I'm having trouble with AttributeList_getValue
> when validating against a Schema - trouble with AttributeList->to_hash():
> 
> No matching function for overloaded 'AttributeList_getValue' at
> /usr/local/lib/perl/5.6.1/XML/Xerces.pm line 261.
> 
> Searching on Google, I've seen other messages on this group regarding
> this issue, but no resolution.  I was wondering if more was known about it.
[snip]

My searching wasn't deep enough - a similar problem in a thread "Problem 
Building Xerces-XML on Linux with Perl 5.6.1" prompted me to add the line:

my $tmp = $self->getName();

to the AttributeList->to_hash method.  Thus:

package XML::Xerces::AttributeList;
sub to_hash {
   my $self = shift;
   my %hash;
   for (my $i=0;$i<$self->getLength();$i++) {
     my $tmp = $self->getName($i);
     $hash{$self->getName($i)} = $self->getValue($i)
   }
   return %hash;
}

I made this change to my local copy of Xerces.pm after running "make", 
but before "make install" and lo - all is well!

I hope this will help others who may be in the same spot.  Meanwhile, 
thanks to Eric and Jason for the idea :-)

All the best,

Bob.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.