Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004096 [Squeak Packages] XML-Yaxo minor always 07-07-06 12:14 10-31-07 16:21
Reporter aplantec View Status public  
Assigned To michael
Priority normal Resolution won't fix  
Status closed  
Summary 0004096: With XPath package, XMLNode>>parent instance variable is always nil
Description XMLNode>>parent instance variable is added by XPath package.
Its value is valid only for XMLStringNode instance but all other nodes (XMLElement instances) have parent == nil.

test :
XMLDOMParser addressBookXMLWithDTD explore

a trivial fix is included
Additional Information Here is the fix,
"newElement parent: self top" is added after newElement creation


XMLDOMParser>>startElement: localName namespaceURI: namespaceUri namespace: namespace attributeList: attributeList
    | newElement |
    "newElement _ namespace = self defaultNamespace
        ifTrue: [XMLElement named: localName namespace: nil uri: nil attributes: attributeList]
        ifFalse: [XMLElement named: localName namespace: namespace uri: namespaceUri attributes: attributeList]."
    newElement _ XMLElement named: localName namespace: namespace uri: namespaceUri attributes: attributeList.
    newElement parent: self top. " parent assignment fix here "
    self incremental
        ifFalse: [self stack isEmpty
            ifFalse: [self top addElement: newElement]].
    self push: newElement
Attached Files  XPath-parent-fix.1.cs.gz [^] (375 bytes) 07-07-06 12:22
 XPath-parent-fix.2.cs.gz [^] (878 bytes) 07-08-06 00:55

- Relationships

- Notes
(0005596 - 377 - 407 - 407 - 407 - 407 - 407)
nicolas cellier
07-07-06 12:44

Just reading this code, shouldn't the fix better be placed at same level than (self top addElement:)?

I do not have other source accessible, but (self stack isEmpty) looks like a protection against (self top) failure.

If double link parent<->children is to be established systematically, then couldn't (anElement parent: self) be simply sent from (addElement: anElement)?
 
(0005597 - 685 - 970 - 970 - 970 - 970 - 970)
aplantec
07-07-06 17:44
edited on: 07-08-06 01:00

"from Nicolas: If double link parent<->children is to be established systematically, then couldn't (anElement parent: self) be simply sent from (addElement: anElement)?"

Yes, that's better

XMLNodeWithElements>>addElement: anElement
    self elements add: element.
    element parent: self

XMLElement>>addContents: contentString
    self contents add: contentString.
        contentString parent: self

3 x "newElement parent: self top" removed, from
- XMLDOMParser>>startElement:attributeList:
- XMLDOMParser>>processingInstruction:data:
- XMLDOMParser>>characters:

That's simpler and no more stack bug possibility.
thanks for fixing the fix, I have uploaded a new one.

 
(0011406 - 86 - 96 - 96 - 96 - 96 - 96)
michael
10-31-07 16:21

As the XPath package adds the inst var it should also provide the "fix" as an override
 

- Issue History
Date Modified Username Field Change
07-07-06 12:14 aplantec New Issue
07-07-06 12:22 aplantec File Added: XPath-parent-fix.1.cs.gz
07-07-06 12:44 nicolas cellier Note Added: 0005596
07-07-06 17:44 aplantec Note Added: 0005597
07-07-06 23:16 pmm Issue Monitored: pmm
07-08-06 00:55 aplantec File Added: XPath-parent-fix.2.cs.gz
07-08-06 00:59 aplantec Note Edited: 0005597
07-08-06 01:00 aplantec Note Edited: 0005597
07-15-06 12:07 MarcusDenker Project Squeak => Squeak Packages
07-17-06 20:22 MarcusDenker Status new => assigned
07-17-06 20:22 MarcusDenker Assigned To  => michael
10-31-07 16:21 michael Status assigned => closed
10-31-07 16:21 michael Note Added: 0011406
10-31-07 16:21 michael Resolution open => won't fix


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
60 total queries executed.
38 unique queries executed.
Powered by Mantis Bugtracker