As example we use our demo listing at http://www.iopus.com/imacros/demo/v6/ex ... sting1.htm
The standard extraction macro is:
Code: Select all
URL GOTO=http://www.iopus.com/imacros/demo/v6/extract1/listing1.htm
TAG POS=1 TYPE=B ATTR=TXT:Salary:
TAG POS=R-1 TYPE=NOBR ATTR=TXT:* EXTRACT=TXT
TAG POS=1 TYPE=B ATTR=TXT:*Position*
TAG POS=R-1 TYPE=NOBR ATTR=TXT:* EXTRACT=TXT
TAG POS=1 TYPE=B ATTR=TXT:*Ref*
TAG POS=R-1 TYPE=NOBR ATTR=TXT:* EXTRACT=TXT
The problem with this macro is that if e. g. the "Position:" information is missing, you will get a TAG error message.
Solution: Extract the anchor text, too! This way you will (a) get no TAG error if the anchor missing and you can easily match anchor text with extracted information:
Code: Select all
URL GOTO=http://www.iopus.com/imacros/demo/v6/extract1/listing1.htm
TAG POS=1 TYPE=B ATTR=TXT:Salary: EXTRACT=TXT
TAG POS=R-1 TYPE=NOBR ATTR=TXT:* EXTRACT=TXT
TAG POS=1 TYPE=B ATTR=TXT:*Position* EXTRACT=TXT
TAG POS=R-1 TYPE=NOBR ATTR=TXT:* EXTRACT=TXT
TAG POS=1 TYPE=B ATTR=TXT:*Ref* EXTRACT=TXT
TAG POS=R-1 TYPE=NOBR ATTR=TXT:* EXTRACT=TXT