You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Bob Arthur <re...@datacash.com> on 2004/03/17 18:24:38 UTC

Xerces-P AttributeList problem

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)

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.

At first, I was confused why this would be an issue with schemas, until 
I realised that the schema defined default attributes for some elements, 
so that these elements only appeared to contain attributes when parsed 
against the schema.

More information:

Running make test, AttributeList.t fails at test 5 with the above error
message (other tests also fail - I can provide details if necessary).

 From my tests, it appears that the issue appears whenever there are two 
or more attributes - one attribute works fine.  In particular, when 
there is more than one attribute, getValue(0) works but  it breaks at 
getValue(1).  I tried to see if I could fix this myself, but really 
don't know SWIG at all!

Is there any way round this?  Accessing the attributes by name is not an 
option I'd like to resort to, though if needs must...

Many thanks,

Bob.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


Re: Xerces-P AttributeList problem

Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
Bob Arthur <re...@datacash.com> writes:

> 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;
> }

Yuck. That means that something deeeeeeeeeep down is broken.

> 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 :-)

You're welcome, and I'm glad that it is now working for you. I'll see
what I can do to fix it in a more permanent manner.

Cheers,
jas.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


Re: Xerces-P AttributeList problem

Posted by Bob Arthur <re...@datacash.com>.
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.



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org