Mantis - Squeak Packages
Viewing Issue Advanced Details
547 XML-Yaxo feature always 11-23-04 08:58 10-31-07 16:13
MarcusDenker  
michael  
normal  
resolved  
fixed  
none    
none  
0000547: [BUG][FIX] XML parser example fails (was: XML parser and friends no documented at all....)
Subject: [BUG][FIX] XML parser example fails (was: XML parser and friends no documented at all....)
Author: Boris Gaertner
Date Posted: 22 November 2004
Archive ID: 25609
Comments:
"stane ducasse" <ducasse@iam.unibe.ch> wrote:

> hi all
>
> As usual no comment and no example for the XML-Parser classes.
>
> Does someone has some tests/examples for this package? Because I never
> output xml....
>
> XMLDOMParser addressBookXMLWithDTD leads to an error.

That worked in Squeak 3.4 and in Squeak 3.6.

I did the example step-by-step with 3.6 and with 3.7
and found that XMLTokenizer>>nextLiteral was changed.
In earlier versions, we had
  validChars := ':-_.' asSet.
Now we have a class variable LiteralChars that is an array
of boolean values. The value at position " asciiValue + 1 "
tells us whether the ascii value is a literal char. In the class
this variable LiteralChars is initialized, but regrettable under
the assumption that array indices begin with 0.
That is a bug and its consequence is that the literal
xml:stylesheet is not correctly read.

The attached change set is an attempt to fix the problem.
As the mistake is clearly identified, I think that it should not
be difficult to review the fix. However ...

... Uses of class variables NameDelimiters and DigitTable are

   (NameDelimiters at: char asciiValue)
   (DigitTable at: char asciiValue)

This assumes an index range from 0 to 255 and will inevitably
crash when the character (Character value: 0) is ever read.

I fixed that, too - call me a pedant if you think I am one!
(The fix is in the class initialization and in the methods that
access the class variables).

By the way: Squeak has a class CharacterSet which implements
what tokenizers need: character sets.


> I think it is the time for this wonderful community to wake up....We
> need at least comments and example which can be done using tests.
You are right, but for tests I need more time. Mind that I am
not very experienced with XML; I used that code once to
file in an electronic dictionary, that was all.

> Stef

Greetings,
Boris
 Yaxo-fixes.2.cs [^] (2,703 bytes) 11-23-04 08:58

Notes
(0011404)
michael   
10-31-07 16:13   
Picked up the idea using CharacterSet instead of Array and fixed the problems