Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class name property conflict
Message
From
30/06/2000 10:29:38
 
 
To
30/06/2000 09:55:25
Bob Tracy
Independent Consultant
Driftwood, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00387041
Message ID:
00387062
Views:
13
>I have an app that generates a set of VFP classes from an XML schema. It works fine except when the XML schema has a tag named "Name" which generates a class definition like:
>
>DEFINE CLASS supplier AS xmlSchema
>Name=''
>Address=''
>.
>.
>ENDDEFINE
>
>VFP will barf (Data type is invalid for this property (Error 1732)) when you instantiate the class. I think the answer may be to intercept any "name" attributes and alias them to something else on the input and then convert back when converting the class information into an xml document. I thought I would get some opinions here before I proceed. TIA.

Your analysis is about on the money - collisions with reserved words and predefined property names causes this - in some cases, this will bite you out of the blue, like the hidden hWnd property of OLEControl-derived classes. Nigel's recommendation of prefixing or postfixing the property name in a consistent fashion - eg __Name or Name__ rather than Name is a good workaround for the problem. It's not just properties - you can collide with event and method names as well.

I prefer to use the "__" rather than "_", especially in postfix use, since some things like _ASSIGN method names are formed from (propertyname) + "_ASSIGN"

Ed
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform