Ver Mensaje Individual
  #10  
Antiguo 18-08-2005
Avatar de mamcx
mamcx mamcx is offline
Moderador
 
Registrado: sep 2004
Ubicación: Medellín - Colombia
Posts: 3.913
Reputación: 25
mamcx Tiene un aura espectacularmamcx Tiene un aura espectacularmamcx Tiene un aura espectacular
Precisamente en el foro de ThirdyParty de Borland salio esta pregunta, he aqui algunos componentes que te pueden ayudar:

http://www.compnet101.com/atagparser/

Un ejemplo que postearon en el foro:

Código Delphi [-]
 
  procedure TForm1.ATagParserTag(Sender: TObject; Tag: TTagElement;
    var Abort: Boolean);
  var
    Index: Integer;
  begin
    Index := FindTagID(Tag.Hash);
    Case Index Of
      TID_TABLE : { the table tag }
       Begin
         Case Tag.ElementType Of
           etSimpleTag, etComplexTag :
             // the < table > tag
             // Inc(TableCount) or you can create an instance
             // of TTagElement, assign the Tag to it and push
             // it on an object stack
           etEndTag :
             // the < / table > tag
         End;
       End;
      TID_TD    : { the table data tag }
       Begin
         Case Tag.ElementType Of
           etSimpleTag, etComplexTag :
             // the < td > tag
           etEndTag :
             // the < /td > tag
         End;
       End;
      TID_TR    : { the table row tag }
       Begin
         Case Tag.ElementType Of
           etSimpleTag, etComplexTag :
             // the < tr > tag
           etEndTag :
             // the < / tr > tag
         End;
       End;
    End;
  end;


http://www.yunqa.de/delphi/htmlparser/

Estos dos de pago, pero a bajo precio. El segundo lo he evaluado y quizas lo compre mas tarde...

Tambien, un ejemplo de como hacerlo automatizando Explorer:

Código Delphi [-]
  uses MSHTML_TLB;
  
  wb: TWebBrowser;
  
  wb.navigate(your html file);
  
  in wb.OnDocumentComplete write something like:
  
  var
   doc: IHTMLDocument2;
   btnText: string;
  begin
   doc := wb.document as IHTMLDocument2;
   //now find your element, let's say you want the text of the first button in 
  the file
   btnText := ((doc.tags('button')  as IHTMLElementCollection).item(0, '') as 
  IHTMLButtonElement).InnerText;

Ahora la vuelta para cargar la tabla es mas complicada... te toca mirar las ayudas en MSDN....

Seguro habra otros parsers por ahi... mirate en torry.net...
__________________
El malabarista.

Última edición por vtdeleon fecha: 01-11-2006 a las 16:51:28.
Responder Con Cita