Example usage for org.dom4j.dom DOMElement getText

List of usage examples for org.dom4j.dom DOMElement getText

Introduction

In this page you can find the example usage for org.dom4j.dom DOMElement getText.

Prototype

public String getText() 

Source Link

Usage

From source file:hello.W2j.java

License:Apache License

private void readManufacturer(Element manufacturerAncorElement, String href, String manufacturer,
        Document document2) {/*from   ww  w.j  av  a 2 s .c  o m*/
    List<Element> allManufacturerAutos = document2
            .selectNodes("/html/body/div/table//a[contains(@href,'" + manufacturer + "')]");
    //            addOl1ToLastLi(selectNodes2);
    logger.debug(href + " :: " + allManufacturerAutos.size());
    if (true) {
        cnt2 = 0;
        for (Element autoElement : allManufacturerAutos) {
            //                  addOl1Ol2Li(element2);
            String autoHref = autoElement.attributeValue("href");

            DOMElement parent = (DOMElement) autoElement.getParent();
            DOMElement previousSibling = (DOMElement) parent.getPreviousSibling();
            String autoName = autoElement.getText().trim();
            if (previousSibling != null) {
                if (previousSibling.getName().equals("h2")) {
                    autoName = "-- " + previousSibling.getText() + " -- " + autoName;
                }
            }
            autoName = autoName.trim();
            String replace = autoHref.replace("/", "");
            if (replace.equals(manufacturer) || autoHref.equals(domain))
                continue;
            //            if(!autoName.contains(yearMin))               continue;
            for (int y = year; y <= year; y++) {
                if (autoName.contains("" + y)) {
                    //                  autoDocument = createAutoDocument();

                    autoTileAllIndexNr = 0;
                    String htmlOutFileName = getHtmlOutFileName(autoName.replaceAll(" ", "_"), manufacturer);
                    String htmlOutFileName2 = htmlOutFileName + ".json";
                    logger.debug(htmlOutFileName2);
                    File f = new File(htmlOutFileName2);
                    if (f.exists()) {
                        logger.debug("f.exists() --  " + htmlOutFileName2);
                        continue;
                    }

                    readAutoIndexList(autoHref, autoName, manufacturer);
                    //            readAuto(autoHref, autoName, manufacturer);
                    cnt2++;
                    System.out.println("-----------------------------------------------------" + cnt2);
                    //            if(cnt2==1)
                    //               break;
                }
            }
        }
    }
}