[BUG][FIX] XML parser example fails (was: XML parser and friends no
documented at all....)
Boris Gaertner
Boris.Gaertner at gmx.net
Mon Nov 22 18:11:14 UTC 2004
"stéphane ducasse" <ducasse at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Yaxo-fixes.2.cs
Type: application/octet-stream
Size: 2702 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20041122/4aff3e48/Yaxo-fixes.2.obj
More information about the Squeak-dev
mailing list
|