Manila syndication error: array out of range - problem solved

Jim Byrne Manila-Newbies@userland.com
Fri, 23 Nov 2001 17:24:56 +0000


In case anyone else comes across this problem with Manila syndication - her=
e
is why it happens and how to avoid it.

The Manila syndication script uses string.patternMatch() which is case
sensitive - the script expects to find only lower case tags. I used upper
case HTML tags and got caught out. Correct me if I'm wrong but this seems
like a bug. No?

From now on I need to remember that when adding to my news - USE LOWER CASE
TAGS.

All the best,
Jim


on 21/11/01 5:21 pm, Jim Byrne at j.byrne@gcal.ac.uk wrote:

> on 19/11/01 3:49 pm, Jim Byrne at j.byrne@gcal.ac.uk wrote:
>=20
>> I have turned on syndication for my Manila site. But when I point
>> to the file=20
>> http://www.ispn.gcal.ac.uk:81/makingconnections/xml/scriptingNews2.xml I=
 get
>> the following error message:
>>=20
>> <?xml version=3D"1.0" ?>
>> =A0 <error>Array index is out of range. The list "lines" doesn't have an i=
tem
>> #3.</error>
>>=20
>> I have looked in the scriptingNews2.xml script which is in the xml table=
 of
>> my makingconnections Manila Website - but it doesn't seem to be running =
that
>> script at all. What script is it running? How do I debug it?
>>=20
>=20
> There error is somewhere in the bundle below ( of the script
> getScriptingNewsXml) - four urls are being returned and only 3 pieces of
> text for the links:
>=20
> on extractLinks (s, adrLinks, adrLines) {
> local (links =3D {}, lines =3D {}, pat =3D "<a href=3D\"", ix, leftHalf);
> s =3D html.processMacros (s, true, pta);
> loop {
> ix =3D string.patternMatch (pat, s);
> if ix =3D=3D 0 {
> break};
> leftHalf =3D string.mid (s, 1, ix - 1);
> s =3D string.delete (s, 1, ix + sizeOf (pat) - 1);
> ix =3D string.patternMatch ("\"", s); //the end of the url
> url =3D string.mid (s, 1, ix - 1);
> s =3D string.delete (s, 1, ix);
> ix =3D string.patternMatch (">", s); //PBS 11/1/00: find end of
> opening a tag
> s =3D string.delete (s, 1, ix);
> if s [1] =3D=3D ">" {
> s =3D string.delete (s, 1, 1)};
> ix =3D string.patternMatch ("</a>", s);
> lineText =3D string.mid (s, 1, ix - 1);
> s =3D s - "</a>";
> s =3D leftHalf + s;
> links =3D links + url;
> lines =3D lines + lineText};
> adrLinks^ =3D links;
> adrLines^ =3D lines;
> return (s)}
>=20
> Is this a bug? If so can someone look into it please.
>=20
> Thanks,
> Jim

=20
--=20
Jim Byrne Project Director, The Making Connections Unit, Glasgow Caledonian
University, Glasgow G4 OBA, 0141 331 3893

Everything you need to know about publishing accessible information on the
Web.

The Making Connections Unit: http://www.mcu.org.uk/

Scottish Disability Information Mailing list:
http://www.mcu.org.uk/mailinglists/