Package net.htmlparser.jericho

Examples of net.htmlparser.jericho.Source


          continue;
        }
        server.setServerStatus(DotColor.GREEN);
        String page = statuspage.getPageContent();

        Source source = new Source(page);

        source.fullSequentialParse();

        List<Element> tableHeaders = source
            .getAllElements(HTMLElementName.H2);
        for (Element tableHeader : tableHeaders) {
          String contents = tableHeader.getTextExtractor().toString();
          if ("Applicatie status".equals(contents)) {
            fetchApplicationInfo(server, tableHeader
View Full Code Here


          alerts.add(alert);
          continue;
        }
        String page = statuspage.getPageContent();

        Source source = new Source(page);

        source.fullSequentialParse();

        List<Element> tableHeaders = source.getAllElements("class",
            "main_label", true);
        for (Element tableHeader : tableHeaders) {
          String contents = tableHeader.getContent().toString();
          if ("Actieve sessies:".equals(contents)) {
            fetchNumberOfUsers(server, tableHeader);
View Full Code Here

          alerts.add(alert);
          continue;
        }

        String page = statuspage.getPageContent();
        Source source = new Source(page);

        source.fullSequentialParse();

        List<Element> tableHeaders = source
            .getAllElements(HTMLElementName.TH);
        for (Element tableHeader : tableHeaders) {
          String contents = tableHeader.getContent().toString();
          if ("Applicatie".equals(contents)) {
            fetchApplicationVersion(server, tableHeader);
          } else if ("Sessions/Requests".equals(contents)) {
            fetchSessionAndRequestData(server, tableHeader);
          } else if ("Wicket Sessions/Requests".equals(contents)) {
            fetchSessionAndRequestData(server, tableHeader);
          } else if ("Sessies/Requests".equals(contents)) {
            fetchSessionAndRequestData(server, tableHeader);
          } else if ("Wicket Sessies/Requests".equals(contents)) {
            fetchSessionAndRequestData(server, tableHeader);
          }
        }

        List<Element> tdHeaders = source
            .getAllElements(HTMLElementName.TD);
        for (Element td : tdHeaders) {
          String contents = td.getContent().toString();
          if ("Starttijd".equals(contents)) {
            getStartTime(server, td);
View Full Code Here

                || StringUtils.inArray(name, elseDirective) || StringUtils.inArray(name, forDirective)
                || StringUtils.inArray(name, macroDirective);
    }

    public String filter(String key, String value) {
        Source source = new Source(value);
        OutputDocument document = new OutputDocument(source);
        replaceChildren(source, source, document);
        return document.toString();
    }
View Full Code Here

     */
    public void parse() {
        out = new StringBuilder();
       
        try {
            Source source = new Source(in);
            source.fullSequentialParse();
           
            String text;
            StringBuilder scripts = new StringBuilder();
            StringBuilder links = new StringBuilder();
            StringBuilder images = new StringBuilder();
            StringBuilder comments = new StringBuilder();
            StringBuilder others = new StringBuilder();
            int numScripts = 1;
            int numLinks = 1;
            int numImages = 1;
            int numComments = 1;
            int numOthers = 1;
           
            text = renderHTMLAsPlainText(source);

            // Get all the tags in the source
            List<StartTag> tags = source.getAllStartTags();
            for(StartTag tag : tags) {
                if(tag.getName().equals("script")) { //NON-NLS
                    // If the <script> tag has attributes
                    scripts.append(numScripts).append(") ");
                    if(tag.getTagContent().length()>0) {
View Full Code Here

    private final Logger LOG = Logger.getLogger(CodeReferenceReplacer.class);

    protected abstract String extractTextToReplaceReference(Element labelParentDiv, Element label);
   
    public String replace(String htmlContent) {
        Source source = new Source(htmlContent);
        source.fullSequentialParse();
        OutputDocument outputDocument = new OutputDocument(source);
        List<Element> references = source.getAllElementsByClass("reference");
        for (Element reference : references) {
            String labelId = reference.getAttributeValue("href").replace("#", "");
            Element label = source.getElementById(labelId);

            Element div = findLabelContainer(label);
            if (!isValidDiv(div)) {
                outputDocument.replace(reference, reference.toString().replace("*", "?"));
                LOG.warn("Could not resolve label: " + labelId);
View Full Code Here

TOP

Related Classes of net.htmlparser.jericho.Source

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.