Package org.jsoup.nodes

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


      // enable annotations on data areas
      parseAnnotatableText (data, child);
    }

    // <base href>: update the base uri
    if (child.tagName().equals("base")) {
      String href = child.absUrl("href");
      if (!Strings.empty(href)) { // ignore <base target> etc
        baseUri = href;
        // TODO - consider updating baseUri for relevant elements in the stack, eg rebase(stack, uri)
        // doc.get().setBaseUri(href); // set on the doc so doc.createElement(Tag) will get updated base
View Full Code Here


                accum.append(txt);
            } else if (child instanceof Element) {
                Element element = (Element) child;
                if (accum.length() > 0 && element.isBlock() && !lastCharIsWhitespace(accum))
                    accum.append(" ");
                else if (element.tagName().equals("br"))
                    accum.append(" ");
                appendTextSkipHidden(element, accum);
            }
        }
    }
View Full Code Here

public class HTMLElementImpl extends ElementImpl implements HTMLElement, IInnerHtmlProvidingElement {

  static Element findEnclosingFormElement(Element insideElement) {
    Element e = insideElement;
    while(e != null) {
      if(e.tagName().toUpperCase().equals("FORM"))
        return e;
      e = e.parent();
    }
    return null;
  }
View Full Code Here

 
  static Element findEnclosingSelectElement(Element insideElement) {
   
    Element e = insideElement;
    while(e != null) {
      if(e.tagName().toUpperCase().equals("SELECT"))
        return e;
      e = e.parent();
    }
    return null;
  }
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

        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"))
                    form = (Element) n;

                //setup a lexical scope if we're going into a repeat widget (by reading the previous node)
                final boolean shouldPopScope = lexicalClimb(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

        String dataRef = ExtNodeConstants.ATTR_DATAREF_PREFIX_WITH_NS + key;
        Element elem = getCurrentRenderingElement();
        Object value = null;
        while (value == null && elem != null) {
            // for a faked snippet node, we will just jump over it
            if (elem.tagName().equals(ExtNodeConstants.SNIPPET_NODE_TAG)) {
                String type = elem.attr(ExtNodeConstants.SNIPPET_NODE_ATTR_TYPE);
                if (type.equals(ExtNodeConstants.SNIPPET_NODE_ATTR_TYPE_FAKE)) {
                    elem = elem.parent();
                    continue;
                }
View Full Code Here

        String blockingParentId;
        for (Element elem : elems) {
            searchElem = elem.parent();
            blockingParentId = "";
            while (searchElem != null) {
                if (searchElem.tagName().equals(ExtNodeConstants.SNIPPET_NODE_TAG)) {
                    blockingParentId = searchElem.attr(ExtNodeConstants.ATTR_SNIPPET_REF);
                    break;
                } else {
                    searchElem = searchElem.parent();
                }
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.