Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Instantiate MSHTML and Parse/modify the DOM?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00910310
Message ID:
00910441
Vues:
20
Do you happen to know if the DOM is read/write in an "InternetExplorer.Application" application object? Or is it readonly?
Oh yeah... another possible problem: I want to pass in HTML text. I don't want to deal with temporary files, which might be a requirement because NavigateTo might be the only way to load the DOM.

>Mark
>Why do you need the DHTMLEdit control, and does it work using:
>oExp = CreateObject("InternetExplorer.Application" ) ?
>
>Jaime
>
>>I need to programmatically parse and modify snippets of HTML on the fly using the DOM. I would like to do it invisibly and efficiently, i.e., just a parser to give me the DOM the way MSXML does for XML. It seems that MSHTML provides the capabilities to do that, but I have not been able to determine if it has a COM interface compatible with VFP. I need something like:
>>
oParser=CreateObject("MSHTML.HTMLDocument")
>>cHTMLDocument="<HEAD></HEAD><BODY>" + cMyHTMLSnippet + "</BODY></HTML>"
>>oParser.DocumentHTML=cHTMLDocument
>>&&  ... Wait for not busy, then...
>>nImages=oParser.Document.DOM.Images.Length
>>&& ...Do something with each image element, such as set height and width attribs
>>For i=0 to nImages-1
>>  oThisImage=oParser.Document.DOM.Images[i]
>>  etc...
>>Endfor
>>&& ... Extract the modified HTML (document.body.innerHTML)
>>cNewHTML=oParser.Document.DOM.body.innerHTML
>>
I can do this, and have it working, by using the DHTMLEdit control and driving it programmatically, but it seems to insist on being instantiated as a form-based control in order to operate. So I have this unnecessary form creation/destruction (and hiding issues). Isn't there a better way? Thanks for any suggestions!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform