Package com.ontometrics.scraper.extraction

Examples of com.ontometrics.scraper.extraction.Field


    fields = scraper.url(TableWithMultipleValuesOnMultipleRows.getUrl()).extract(scraper.extractor().getFields())
        .getFields();

    log.info("fields from table with multiple values on rows: {}", fields);

    Field cfdaNumbers = null;
    for (Field field : fields) {
      if (field.getLabel().equals("CFDA Number(s)")) {
        cfdaNumbers = field;
      }
    }

    assertThat(fields.size(), is(1));
    assertThat(cfdaNumbers, is(notNullValue()));
    assertThat(cfdaNumbers.getValue().contains(";"), is(true));

  }
View Full Code Here


    int foundOccurrenceCount = 0;
    int foundIndex = -1;

    if (fields != null && fields.size() > 0) {
      for (int i = 0; i < fields.size(); i++) {
        Field field = fields.get(i);
        if (field.getLabel().equalsIgnoreCase(label)) {
          foundOccurrenceCount++;
          if (foundOccurrenceCount == occurrence) {
            foundIndex = i;
            break;
          }
        }
      }

      if (foundIndex != -1) {
        fields.remove(foundIndex);
        Field newField = new ScrapedField(label, value);
        fields.add(foundIndex, newField);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.ontometrics.scraper.extraction.Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.