Problem running samples of Indelv's XML Parser 
Author Message
 Problem running samples of Indelv's XML Parser

        Running any of the samples in IdXWalkerParseAppExample results in a
"primitive failed" walkback inside the method #at:put: of class String.
In all examples, a nil value is being placed inside a string. Had anyone
else seen this and/or privided a fix?

Jun Nolasco



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem running samples of Indelv's XML Parser
        I forgot to mention I am using both VAST 4.5a and 5.0.
Quote:

>         Running any of the samples in IdXWalkerParseAppExample results in a
> "primitive failed" walkback inside the method #at:put: of class String.
> In all examples, a nil value is being placed inside a string. Had anyone
> else seen this and/or privided a fix?

> Jun Nolasco



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem running samples of Indelv's XML Parser
Its a bug in the IdXWalkerParseAppExample>>characters:start:length: method.
It does not take into account that the <charArray> argument is not a string
but an array of characters and possibly nil values. (Java garbage?)
A fix to take you throgh the example would be:

!IdXWalkerParseAppExample methods !

characters: charArray start: start length: length
        "000124  TA  charArray contains non character objects"

    Transcript cr; show: 'char data: ', ((charArray ideToStringFromZero:
start length: length) ifNil: [String new]).
! !

I have been looking brefly on the code and a few things strikes me so far:

- Why this "Impl" extension on some of the DOM-class names? (Only som of
them)
- You cannot send #do: to an instance of (Id)NodeList(Impl). Of course this
is a Java port but...
- Why do one (even in Java) have an instance variable with an integer to
indicate what "class" a StringNode represents? Why not simply the subclasses
IdTextNode, IdCommentNode and IdCDataNode? (why at all the NodeType
stuff...)

Is there any work going on on this package? It seems to me a
Smaltalkifiation would make it easier to use. The Document Object Model
could still be folowed.

/Thomas Antser



Quote:
> Running any of the samples in IdXWalkerParseAppExample results in a
> "primitive failed" walkback inside the method #at:put: of class String.
> In all examples, a nil value is being placed inside a string. Had anyone
> else seen this and/or privided a fix?

> Jun Nolasco



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem running samples of Indelv's XML Parser

Quote:
> - Why this "Impl" extension on some of the DOM-class names? (Only som of
> them)

I would imagine, since this was a port from Java, that these classes
were subclassed as an implementation class in Java.  Just a guess
though.

Quote:
> - You cannot send #do: to an instance of (Id)NodeList(Impl).

I found this frustrating as well.  I ended up subclassing the
IdCompositeNode and implementing a method #nodesDo: aBlock .... I got
tired of continually having to write 1 to: (theNode getLength -1) do:
[:aNode | blah blah...]

I also ended up implementing a method #attributesDo: aBlock which
iterated over the nodes attributes.

Matt



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem running samples of Indelv's XML Parser


Quote:
> Its a bug in the IdXWalkerParseAppExample>>characters:start:length:
method.
> It does not take into account that the <charArray> argument is not a
string
> but an array of characters and possibly nil values. (Java garbage?)
> A fix to take you throgh the example would be:

> !IdXWalkerParseAppExample methods !

> characters: charArray start: start length: length
>         "000124  TA  charArray contains non character objects"

>     Transcript cr; show: 'char data: ', ((charArray ideToStringFromZero:
> start length: length) ifNil: [String new]).
> ! !

I used some of the classes in that package, but I do not have the source
code with me. Does the #ideToStringFromZero:length: handle multi-byte
characters ? XML is supposed to handle Unicode characters.

Quote:

> I have been looking brefly on the code and a few things strikes me so far:

> - Why this "Impl" extension on some of the DOM-class names? (Only som of
> them)
> - You cannot send #do: to an instance of (Id)NodeList(Impl). Of course
this
> is a Java port but...
> - Why do one (even in Java) have an instance variable with an integer to
> indicate what "class" a StringNode represents? Why not simply the
subclasses
> IdTextNode, IdCommentNode and IdCDataNode? (why at all the NodeType
> stuff...)

Some of your questions can be answered by the IDL definition of the DOM:
http://www.w3.org/TR/REC-DOM-Level-1/idl-definitions.html
-- Those *impl classes are implementations of the IDL interfaces.
-- NodeType is an attribute in the Node interface.

What I do not like about the package is that the package does not follow the
Smalltalk language mapping for IDL. For example, accessors like #getLength
should have been #length.

Quote:
> Is there any work going on on this package? It seems to me a
> Smaltalkifiation would make it easier to use. The Document Object Model
> could still be folowed.

BTW, would there be someone working on validating parser in Smalltalk?
Quote:

> /Thomas Antser



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem running samples of Indelv's XML Parser

Quote:
> I used some of the classes in that package, but I do not have the source
> code with me. Does the #ideToStringFromZero:length: handle multi-byte
> characters ? XML is supposed to handle Unicode characters.

I dont know. Is Unicode strings part of the Smalltalk standard?

Quote:

> > I have been looking brefly on the code and a few things strikes me so
far:

> > - Why this "Impl" extension on some of the DOM-class names? (Only som of
> > them)
> > - You cannot send #do: to an instance of (Id)NodeList(Impl). Of course
> this
> > is a Java port but...
> > - Why do one (even in Java) have an instance variable with an integer to
> > indicate what "class" a StringNode represents? Why not simply the
> subclasses
> > IdTextNode, IdCommentNode and IdCDataNode? (why at all the NodeType
> > stuff...)

> Some of your questions can be answered by the IDL definition of the DOM:
> http://www.w3.org/TR/REC-DOM-Level-1/idl-definitions.html
> -- Those *impl classes are implementations of the IDL interfaces.
> -- NodeType is an attribute in the Node interface.

> What I do not like about the package is that the package does not follow
the
> Smalltalk language mapping for IDL. For example, accessors like #getLength
> should have been #length.

Yapp. #length it should be. Apperantly even the OMG says so. (even if I
would have it named #size)

And of course, the "impl" extension have a meaning in Java where you name an
interface as a class! The Java people probably dont realize the semantic
power of OO, at least it seems so to me. Its absurd to talk about instances
of implementations! Having aNodeListImplementation is quite different thing
compared to having aNodeList! The instance is simply not the implementation.

I also understand that the NodeType is part of the DOM standard. I can live
with having an integer telling me what kind of object i have, i don't have
to use it. But why mess upp the instances with a variable for it? Is that a
better style in Java?



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Run into problem when running the sample of ActiveTCL

2. Validation with XML Schemas with Clarion 5.5 and Microsoft XML Parser 4.0

3. Validating XML-parser using XML Schema?

4. Anyone using CL-XML(a xml parser)?

5. XML Parser problem

6. Q: Can't run samples

7. Problem Running MF Cobol Sample Program

8. CW5EE Run( 'excel' ) Problem

9. XML/XSL samples

10. XML/Ada sample programs

11. Looking for large VHDL sample code to test VHDL parser

12. Parser test samples?

 

 
Powered by phpBB® Forum Software