Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stripping HTML keeping Text
Message
De
18/11/2010 02:59:25
 
 
À
17/11/2010 18:19:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01489477
Message ID:
01489515
Vues:
64
>>>I'm pulling HTML off the internet and into a string then a memo field. I only want the text. How do I go about cleaning the HTML out of the string?
>>
>>Did you try using InnerText property?
>>Re: Control eh? Thread #1488307 Message #1488318
>
>I am no longer using the WEBBR4OWSER41 - It's Tore's code with which I am playing.

Using simple automation:
lcURL='http://www.levelextreme.com'
lnTime=1200 && 12 seconds
lox=Createobject('internetexplorer.application')
lox.Visible=.t.
lox.Navigate(lcURL)
lox.Visible=.T.
Wait 'Navigating!' Window Nowait
If !NavComplete(lox,lnTime)
   ??Chr(7)
   Wait 'Timeout feil!' Window
   lox.Visible=.F.
   Release lox
   Return
Endif
Wait Clear
lcHTML=lox.document.body.innertext
If !Empty(lcHTML)
   MessageBox(lcHTML)
EndIf    

*****************************************************************************
Function NavComplete
   Lpara toIE, tnTimeout
   lnTimeout=Iif( Type("tnTimeout")="N",tnTimeout ,60 )
   lnTimeElapsed=0
   lnStartSeconds=Seconds()
   Do While .T.
      If toIE.ReadyState=4 And !toIE.Busy
         Do While .T.
            If toIE.Document.ReadyState="complete"
               Return .T.
            Endif
            If (Seconds()-lnStartSeconds)>lnTimeout
               Return .F.
            Endif
         Enddo
      Endif
      If (Seconds()-lnStartSeconds)>lnTimeout
         Return .F.
      Endif
   Enddo
Endfunc
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform