Alaska Software Inc. - Crash setproperty
Alaska Software Inc. - Crash setproperty
Username: Password:
AuthorTopic: Crash setproperty
Hector PezoaCrash setproperty
on Mon, 23 Jul 2018 12:28:33 -0400
I have problems with a property in activex
  I'm running this code in visual fox pro, and I'm not having any trouble.
  If I run it on Alaska xbase 1.9 , it doesn't work
   oParser = CREATEOBJECT("MSXML2.DOMDocument.6.0")
    //oParser = ActiveXObject():create("MSXML2.DOMDocument.6.0")
    oParser:Async = .F.
    oParser:preserveWhiteSpace := ::Op_WhiteSpace
    oParser:setProperty("ProhibitDTD",  .F. )  ----->  crash error  Alaska 
xbase++
    oParser:validateOnParse := !::Op_DTD

    oParser:setProperty( "Property", "ProhibitDTD",  .F. )  ----->  crash 
error  Alaska xbase++

    See Jim's  message 18/06/2018
    ::oMails:setProperty("Folders","Xbase") -> crash

   You will have solve your problem  with alaska xbase++
   Xbase  does not handle type conversion well

   BestRegard
   Hector Pezoa
Andreas Gehrs-Pahl
Re: Crash setproperty
on Mon, 23 Jul 2018 13:08:52 -0400
Hector,

>oParser:setProperty("ProhibitDTD", .F.)  ----->  crash error  Alaska xbase++
>oParser:setProperty("Property", "ProhibitDTD", .F.)  ----->  crash 

The "ProhibitDTD" property is a "second level" property, which needs to be 
set with the Method "setProperty". The Alaska "ActiveXObject" class also 
includes a method called "setProperty" (which is inherited from the 
"AutomationObject" class). So you will have to use:

oParser:CallMethod("setProperty", "ProhibitDTD", .f.)

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Hector PezoaRe: Crash setproperty
on Mon, 23 Jul 2018 13:59:44 -0400
Hi Andreas

Grateful for your prompt reply
I recognize tha people like you help make great xbase++

But this leaves me busy dialing ???
The "ProhibitDTD" property is a "second level" property, which needs to be
 set with the Method "setProperty". The Alaska "ActiveXObject" class also
 includes a method called "setProperty"    ????
(which is inherited from the  "AutomationObject" class). So you will have to 
use:

> oParser:CallMethod("setProperty", "ProhibitDTD", .f.)
>
> Hope that helps,      Yes, Now Ok

Thank you
best regard
Hector Pezoa



<Andreas Gehrs-Pahl> escribi en el mensaje 
news:1fr6op0t2rkky$.1aijy3w9ppuua.dlg@40tude.net...
> Hector,
>
>>oParser:setProperty("ProhibitDTD", .F.)  ----->  crash error  Alaska 
>>xbase++
>>oParser:setProperty("Property", "ProhibitDTD", .F.)  ----->  crash
>
> The "ProhibitDTD" property is a "second level" property, which needs to be
> set with the Method "setProperty". The Alaska "ActiveXObject" class also
> includes a method called "setProperty" (which is inherited from the
> "AutomationObject" class). So you will have to use:
>
> oParser:CallMethod("setProperty", "ProhibitDTD", .f.)
>
> Hope that helps,
>
> Andreas
> -- 
> Andreas Gehrs-Pahl
> Absolute Software, LLC
>
> phone: (989) 723-9927
> email: Andreas@AbsoluteSoftwareLLC.com
> web:   http://www.AbsoluteSoftwareLLC.com
> [F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Andreas Gehrs-Pahl
Re: Crash setproperty
on Mon, 23 Jul 2018 17:05:13 -0400
Hector,

>But this leaves me busy dialing ???

I assume that the above means that my explanation wasn't good enough. So, 
let me try again:

Alaska added the "AutomationObject" and "ActiveXObject" classes to Xbase++ 
to allow the (relatively) easy implementation of COM/ActiveX components. 
Like any Xbase++ classes, those two classes have various methods (and 
properties), such as ":Create()", ":Destroy()", and ":Cargo". They also 
include several additional low-level methods, including: ":GetProperty()", 
":SetProperty()" and ":CallMethod()".

When you create an Xbase++ AutomationObject or ActiveXObject, all the 
Methods and Properties of the COM/ActiveX component are automatically made 
available to you through the created Xbase++ objects. In your example that 
includes the ":Async" and ":PreserveWhiteSpace" properties, which you can 
access directly like this:

oParser:Async := .f.
oParser:PreserveWhiteSpace := .t.

or indirectly, like this:

oParser:SetProperty("Async", .f.)
oParser:SetProperty("PreserveWhiteSpace", .f.)

But when the name of a method (or property) conflicts with an existing 
method (or property) name of the "AutomationObject" or "ActiveXObject" 
class, such as a method named ":SetProperty()", then you can't access the 
COM/ActiveX component's method (or property) directly.

In those cases you need to use the low-level methods that were added for 
that purpose, like ":GetProperty()", ":SetProperty()" and ":CallMethod()".

The MSXML ActiveX component has no "ProhibitDTD" property, instead it has a 
method called "SetProperty" to set several (16) so-called "second level DOM 
properties", including "ProhibitDTD". For a complete list see:

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms766391%28v%3dvs.85%29

Because this "SetProperty" method has the same name as the already existing 
Xbase++ method, you can't call it directly. Instead, you need to use the 
Xbase++ method ":CallMethod()", which can be used to access any of the COM/
ActiveX component's methods indirectly, by specifying their name, even if 
the Xbase++ class has a method with the same name.

So, instead of accessing the property directly:

oParser:ProhibitDTD := .f.    <== Error, as there is no such Property

or trying to call the MSXML ActiveX component's method directly:

oParser:SetProperty("ProhibitDTD", .f.)   <== Error, Xbase Method is called

you instead need to call this (hidden) Active-X method indirectly:

oParser:CallMethod("SetProperty", "ProhibitDTD", .f.)

The same is true for the "GetProperty" method of the MSXML DOM component.

If Alaska would have called their method something else, like e.g. 
"ChangeProperty", or if MS would have called their method something else -- 
or if MS would have implemented the "ProhibitDTD" property as a normal 
"first-level DOM Property" (which doesn't require a method call) -- then 
there wouldn't be a conflict, and you wouldn't have to use ":CallMethod()" 
to access the MS "SetProperty" method to set the "ProhibitDTD" property 
value.

I hope that explains it sufficiently.

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Jim LeeRe: Crash setproperty
on Mon, 23 Jul 2018 23:00:57 +0200
> oParser:CallMethod("setProperty", "ProhibitDTD", .f.)

THX to make it clear

btw. how about using Invoke() ?
Hector PezoaRe: Crash setproperty
on Tue, 24 Jul 2018 00:25:49 -0400
Hi  Andrea

Excellent explanation, excuse me for my bad english.
His response was perfect and the error was correct
But the answer you gave me earlier
It was quite a surprise for me
It wasn't  in my knowlodge

Thank you again
Best Regard
Hector Pezoa