Package org.jsoup.nodes

Examples of org.jsoup.nodes.Element.tagName()


        final Elements hs = doc.select("h1, h2, h3, h4, h5");

        listBuilder.append("<ul class='b3-solo-list'>");
        for (int i = 0; i < hs.size(); i++) {
            final Element element = hs.get(i);
            final String tagName = element.tagName().toLowerCase();
            final String text = element.text();
            final String id = "b3_solo_" + tagName + "_" + i;

            element.before("<span id='" + id + "'></span>");
View Full Code Here


        public void head(Node node, int depth) {
            if (!(node instanceof Element)) {
                return;
            }
            Element tag = (Element) node;
            String tagName = tag.tagName().toLowerCase();
            if (tagName.equals(TAG_BODY)) {
                extractAttribute(tag, ATT_BACKGROUND);
            } else if (tagName.equals(TAG_SCRIPT)) {
                extractAttribute(tag, ATT_SRC);
            } else if (tagName.equals(TAG_BASE)) {
View Full Code Here

        public void head(Node node, int depth) {
          if (!(node instanceof Element)) {
            return;
          }
          Element tag = (Element) node;
            String tagName = tag.tagName().toLowerCase();
            if (tagName.equals(TAG_BODY)) {
                extractAttribute(tag, ATT_BACKGROUND);
            } else if (tagName.equals(TAG_SCRIPT)) {
              extractAttribute(tag, ATT_SRC);
            } else if (tagName.equals(TAG_BASE)) {
View Full Code Here

  }

  private String extractEventGroup(Element eventDiv) {
    try {
      Element catH2 = eventDiv.previousElementSibling();
      while (!catH2.tagName().toLowerCase().equals("h2")) {
        catH2 = catH2.previousElementSibling();
      }
      Element catA = catH2.select("a").get(0);
      String text = catA.text();
      if (StringUtils.isNotBlank(text)) {
View Full Code Here

            StringBuilder description = new StringBuilder();
            Element descriptionPart = element.parent();
            do {
                description.append(descriptionPart.outerHtml());
            } while ((descriptionPart = descriptionPart.nextElementSibling()) != null && !descriptionPart.tagName().equals("h2"));

            File docFile = new File(outputDirectory, name + ".html");
            if (!docFile.exists()) {
                FileUtils.writeStringToFile(docFile, description + "<br><i>Module: " + moduleFile.getName() + "</i>");
            } else {
View Full Code Here

  private boolean isBlock(Node n) {
    boolean block = false;
    if(n != null && n instanceof Element) {
      Element el = (Element)n;
      block = el.isBlock() || el.tagName().equals("br");
    }
    return block;
  }

  private String ltrim(String s) {
View Full Code Here

        currentNodeHandler.handleTextNode((TextNode) n, this);

      } else if(n instanceof Element) {
        // figure out who can handle this
        Element node = (Element)n;
        String tagName = node.tagName();

        if(nodeList.containsKey(tagName)) {
          // OK, we know how to handle this node
          nodeList.get(tagName).handleNode(currentNodeHandler, node, this);
View Full Code Here

        for (Node n: node.childNodes()) {
            if (n instanceof Element) {
                final Element child = (Element) n;

                //push form if this is a form tag
                if (child.tagName().equals("form"))
                    pc.form = (Element) n;

                //setup a lexical scope if we're going into a repeat widget (by reading the previous node)
                final boolean shouldPopScope = lexicalClimb(pc, child);
View Full Code Here

    private static String cleanHtml(final Node node) {
        if (node instanceof Element) {
            Element element = ((Element) node);
            StringBuilder accum = new StringBuilder();
            accum.append("<").append(element.tagName());
            for (Attribute attribute: element.attributes()) {
                if (!(attribute.getKey().startsWith("_"))) {
                    accum.append(" ");
                    accum.append(attribute.getKey());
                    accum.append("=\"");
View Full Code Here

            } else {
                accum.append(">");
                for (Node child : element.childNodes())
                    accum.append(cleanHtml(child));

                accum.append("</").append(element.tagName()).append(">");
            }
            return accum.toString();
        } else if (node instanceof TextNode) {
            return ((TextNode) node).getWholeText();
        } else if (node instanceof XmlDeclaration) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.