Discussion Thread

Data Extractor

Message Thread

For WindowsData Extractor

Data Extractor iconExtract any data, including email addresses and URLs from your files and webpages.

Posted in the Data Extractor Forum.

Tabular Data


Had scratched my head to build a custom rule in Java for extracting the tabular data from the text files I have.

A sample of the data is as follows:
tr style="background-color: #eee"
tdbAlexa Rank:/b/td
tdbLink Popularity:/b/td

I have built the following JavaScript source for doing this but its incomplete. Can you help me in completing this code:

DataExtractor.AddHeader(1, 'Alexa Rank:');
DataExtractor.AddHeader(1, 'Link Popularity');

var mt = (document.getElementsByID('myTable').rows[0].innerHTML);

if (mt.length 0) {
for (i=0; imt.length; i++) {
DataExtractor.AddResult(1, mt[i].Alexa Rank);
DataExtractor.AddResult(1, mt[i].Link Popularity);

Thanks in advance!

by Vani Aul on Jun 13 2007 6:36am Reply

Tabular Data


Sorry you're having problems, you should try using the following method, I have not tested it but we often use a similar approach when creating rules:

var cells = document.getElementsByTagName('TD');
var nextRow = -1;
for (var i=0; icells.length; i++) {
obj = cells[i];

//Check for real data and enter it in correct place
if (nextRow -1) {
DataExtractor.AddResult(nextRow, obj.innerText);
nextRow = -1; //reset row counter

if (obj.innerText.trim() == 'Alexa Rank:') {
nextRow = 1;
if (obj.innerText.trim() == 'Popularity:') {
nextRow = 2;

For full rule creating you can use our service here:

by Nico Westerdale on Jun 13 2007 10:03am Reply

Tabular Data

Hello Nico,

Thanks for the sample code, i did try it, But on using that in Data Extractor to extract the td data. I got the following message:

There is an error in "icells"

I think this line in the source has a problem:
for (var i=0; icells.length; i++)

Can u help sort it out. I'll be thankful to you.

Kind Regards,
by Vani Aul on Jun 14 2007 11:24am Reply

Tabular Data

You need a less than sign after the "i". Our online forum strips out less than and greter than signs.
by Nico Westerdale on Jun 14 2007 11:28am Reply

Our Software Stores

IconicoAccurate Design and Development Software

BitsDuJourDiscount Deal Coupons for Windows and Mac Software Apps

Our Software Services

IcoBlogOur Official Blog

© copyright 2004-2024 Iconico, Inc. Code & Design. All Rights Reserved. Terms & Conditions Privacy Policy Terms of Use Login