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.
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.
Stef
"stéphane 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
Boris Gaertner wrote:
[snip]
(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!
Not at all :-) I think you are quite right!
Such lookup-arrays are exactly the type of thing that one wants to have a primitive for that implements
atZeroBasedIndex:, so as to avoid the + 1 addition.
BTW one could use a byte-array or a bit-array to get the same effect with (~32 times) less memory use.
[snip]
Cheers,
Peter
Greetings, Boris
squeak-dev@lists.squeakfoundation.org