David Rueter - 2012-03-20

Brian,

Sure, you could use HTML DOM to process HTML data from a table. You would need to do so one row at a time in a loop. You could do something like this:

CREATE TABLE #MyOutputTable(
    [DEID] [int] IDENTITY(1,1) NOT NULL,
    [DocID] [int] NULL,
    [Tag] [varchar](MAX) NULL,
    [ID] [varchar](512) NULL,
    [Name] [varchar](512) NULL,
    [Class] [varchar](512) NULL,
    [TextData] [varchar](MAX) NULL,
    [OpenTagStartPos] [int] NULL,
    [CloseTagEndPos] [int] NULL,
    [ParentDEID] [int] NULL
)

DECLARE @ThisDocID int

DECLARE @ThisHTML varchar(MAX)

DECLARE curThis CURSOR LOCAL STATIC FOR
  SELECT HTMLData
  FROM tblMyBulkHTML

SET @ThisDocID = 0

OPEN curThis

FETCH curThis INTO @ThisHTML
WHILE @@FETCH_STATUS = 0 BEGIN
  SET @ThisDocID = @ThisDocID + 1

  EXEC #spactDOMLoad @DocID = @ThisDocID, @HTML = @ThisHTML

  INSERT INTO #MyOutputTable
  EXEC #spgetDOM @DocID = @ThisDocID

  FETCH curThis INTO @ThisHTML
END
CLOSE curThis
DEALLOCATE curThis

--Now #MyOutputTable contains all the nodes we parsed from all rows
SELECT * FROM #MyOutputTable

I'm not quite sure specifically what you are trying to do. Let me know if I misunderstood your intent.

Also, if you don't mind, I'm going to move this conversation to the forum.

 
Last edit: David Rueter 2012-03-20