View Issue Details

IDProjectCategoryView StatusLast Update
0003360JEDI VCL00 JVCL Componentspublic2005-12-22 03:13
ReportermarcgeldonAssigned Toelahn 
Status resolvedResolutionno change required 
Product Version3.00 
Target VersionFixed in Version 
Summary0003360: TJvSimpleXML Access Violation
DescriptionDrop a TJvSimpleXML component on the form, drop a button on the form. Assign the following source:

JvSimpleXML.Root.Name := 'TEST';
JvSimpleXML.Root.Container.Add('TEST', 'TEST');

Run the project. It'll return an access violation.
TagsNo tags attached.



2005-12-12 12:53

manager   ~0008207

The AV occurs in the second line because the property Container is not assigned.
The helpfile says about Container
"Use Container to determine the list class that owns this item. An item is always a child of its Container"


JvSimpleXML.Root.Items.Add('TEST', 'TEST');

instead to add subitems to the root.


2005-12-13 02:23

reporter   ~0008211

Okay. I understand. Where can I find the documentation?


2005-12-13 02:23

reporter   ~0008212

We should raise an exception if the Container is not assigned, so that we can prevent access violations. This should be changed.


2005-12-13 06:09

administrator   ~0008216

Why? How can you have a container for a root, it's the only element that has no parent?


2005-12-13 18:13

reporter   ~0008218

The idea would be the following: raise an exception if someone tries to access the container (instead of having an AV)


2005-12-14 05:57

developer   ~0008219

The container property is defined:

    property Container: TJvSimpleXMLElems read FContainer write FContainer;

In order to raise an exception, a "GetContainer" method would have to be added that checks if FContainer is nil & raises an exception if so. I am totally against this. Adding this method would only slow down access to the Container property.

If you're not 100% certain that a variable/property contains an object, you should check if it's nil before accessing it.

JVCL Help Files:

Issue History

Date Modified Username Field Change
2005-12-12 09:12 marcgeldon New Issue
2005-12-12 12:53 USchuster Note Added: 0008207
2005-12-13 02:23 marcgeldon Note Added: 0008211
2005-12-13 02:23 marcgeldon Note Added: 0008212
2005-12-13 06:09 obones Note Added: 0008216
2005-12-13 18:13 marcgeldon Note Added: 0008218
2005-12-14 05:57 elahn Note Added: 0008219
2005-12-22 03:13 elahn Status new => resolved
2005-12-22 03:13 elahn Resolution open => no change required
2005-12-22 03:13 elahn Assigned To => elahn