View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006062 | JEDI Code Library | JclSimpleXml | public | 2013-01-15 12:16 | 2013-06-16 23:03 |
Reporter | westphal | Assigned To | jfudickar | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | feedback | Resolution | open | ||
Product Version | Version 2.5 (Subversion repository/Daily zips) | ||||
Target Version | Fixed in Version | ||||
Summary | 0006062: TJclSimpleXMLElems.delete leave ghost item | ||||
Description | using Node.Items.ItemNamed['item1'] to create an element (with option sxoAutoCreate) return wrong element if it was deleted before. see exemple in additional Information | ||||
Additional Information | var xml : TJclSimpleXML; pa,Node : TJclSimpleXMLElem; begin xml := TJclSimpleXML.Create; try pa := xml.Root; pa.Name := 'conf'; Xml.Options := Xml.Options + [sxoAutoCreate]; node := pa.Items.Add('item1'); pa.Items.Add('item2'); //pa.items.Notify(node, opRemove); pa.items.Delete('item1'); node := xml.Root; Node.Items.ItemNamed['item1']; memo1.text := xml.SaveToString; memo1.lines.Add('pa.Items.ItemNamed[''item2''].Name = '+ pa.Items.ItemNamed['item2'].Name +' ???' ); finally xml.Free; end; end; | ||||
Tags | No tags attached. | ||||
Fixed in GIT commit | |||||
Fixed in SVN revision | |||||
IDE version | All | ||||
|
This is a problem when using 2 MRU components and a appXMLstorage, as they use this way to update the xml file. |
|
in the exemple, a/ item1 as index 0 and item2 as index 1 b/ item1 is deleted, then item2 as index 0 c/ item1 is re-created then now item 1 as index 1 the FElems: TJclSimpleItemHashedList; is updated for item1 (FNameHash.Remove) but not for the new index of item2 ! a working correction would be: procedure TJclSimpleItemHashedList.Notify(Ptr: Pointer; Action: TListNotification); begin if (Action = lnDeleted) and (FNameHash <> nil) then begin InvalidateHash; { if FCaseSensitive then FNameHash.Remove(TJclSimpleItem(Ptr).Name) else FNameHash.Remove(UpperCase(TJclSimpleItem(Ptr).Name)); } end; inherited Notify(Ptr, Action); end; |
|
Commited to github |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-01-15 12:16 | westphal | New Issue | |
2013-01-15 12:16 | westphal | IDE version | => All |
2013-01-15 12:17 | westphal | Note Added: 0020331 | |
2013-01-15 13:47 | westphal | Note Added: 0020333 | |
2013-06-16 23:03 | jfudickar | Note Added: 0020532 | |
2013-06-16 23:03 | jfudickar | Assigned To | => jfudickar |
2013-06-16 23:03 | jfudickar | Status | new => feedback |