Package org.jsoup.nodes

Examples of org.jsoup.nodes.Attributes


        }

        @Override
        Tag reset() {
            super.reset();
            attributes = new Attributes();
            // todo - would prefer these to be null, but need to check Element assertions
            return this;
        }
View Full Code Here


    private boolean isValidAnchor(String value) {
        return value.startsWith("#") && !value.matches(".*\\s.*");
    }

    Attributes getEnforcedAttributes(String tagName) {
        Attributes attrs = new Attributes();
        TagName tag = TagName.valueOf(tagName);
        if (enforcedAttributes.containsKey(tag)) {
            Map<AttributeKey, AttributeValue> keyVals = enforcedAttributes.get(tag);
            for (Map.Entry<AttributeKey, AttributeValue> entry : keyVals.entrySet()) {
                attrs.put(entry.getKey().toString(), entry.getValue().toString());
            }
        }
        return attrs;
    }
View Full Code Here

      Element enode = (Element) node;
      String tagname = enode.tagName();
      String text = cleanOutControlChars(enode.text());
      String outerHTML = cleanOutControlChars(enode.outerHtml());
      String innerHTML = cleanOutControlChars(enode.html());
      Attributes attrs = enode.attributes();
      Map<String, String> attributeMap = new HashMap<String, String>();
      for (Attribute attr : attrs) {
        attributeMap.put(attr.getKey(), attr.getValue());
      }
View Full Code Here

    public final static void applyMessages(Element target) {
        String selector = SelectorUtil.tag(ExtNodeConstants.MSG_NODE_TAG);
        List<Element> msgElems = target.select(selector);
        for (Element msgElem : msgElems) {
            Attributes attributes = msgElem.attributes();
            if (!attributes.hasKey(ExtNodeConstants.MSG_NODE_ATTR_KEY)) {
                InvalidMessageException ex = new InvalidMessageException(ExtNodeConstants.MSG_NODE_TAG + " tag must have key attribute.");
                logger.error("", ex);
                continue;
            }
            String key = attributes.get(ExtNodeConstants.MSG_NODE_ATTR_KEY);
            List<String> externalizeParamKeys = getExternalizeParamKeys(attributes);

            // TODO cache localed helper instance
            ParamMapResourceBundleHelper helper = null;
            if (attributes.hasKey(ExtNodeConstants.MSG_NODE_ATTR_LOCALE)) {
                helper = new ParamMapResourceBundleHelper(LocalizeUtil.getLocale(attributes.get(ExtNodeConstants.MSG_NODE_ATTR_LOCALE)));
            } else {
                helper = new ParamMapResourceBundleHelper();
            }

            Map<String, Object> paramMap = getMessageParams(attributes, helper, key, externalizeParamKeys);
View Full Code Here

    public final static void applyMessages(Element target) {
        String selector = SelectorUtil.tag(ExtNodeConstants.MSG_NODE_TAG);
        List<Element> msgElems = target.select(selector);
        for (Element msgElem : msgElems) {
            Attributes attributes = msgElem.attributes();
            String key = attributes.get(ExtNodeConstants.MSG_NODE_ATTR_KEY);
            List<String> externalizeParamKeys = getExternalizeParamKeys(attributes);
            String defaultMsg = ExtNodeConstants.MSG_NODE_ATTRVALUE_HTML_PREFIX + msgElem.html();

            // TODO cache localed helper instance
            ParamMapResourceBundleHelper helper = null;
            if (attributes.hasKey(ExtNodeConstants.MSG_NODE_ATTR_LOCALE)) {
                helper = new ParamMapResourceBundleHelper(LocalizeUtil.getLocale(attributes.get(ExtNodeConstants.MSG_NODE_ATTR_LOCALE)));
            } else {
                helper = new ParamMapResourceBundleHelper();
            }

            Map<String, Object> paramMap = getMessageParams(attributes, helper, key, externalizeParamKeys);
View Full Code Here

        this(tag);
        this.addClass(cssClass);
    }

    public void copyAttributes(Element src) {
        Attributes attrs = src.attributes();
        Iterator<Attribute> it = attrs.iterator();
        Attribute attr;
        while (it.hasNext()) {
            attr = it.next();
            this.attr(attr.getKey(), attr.getValue());
        }
View Full Code Here

    public final static void applyMessages(Element target) {
        String selector = SelectorUtil.tag(ExtNodeConstants.MSG_NODE_TAG);
        List<Element> msgElems = target.select(selector);
        for (Element msgElem : msgElems) {
            Attributes attributes = msgElem.attributes();
            String key = attributes.get(ExtNodeConstants.MSG_NODE_ATTR_KEY);
            List<String> externalizeParamKeys = getExternalizeParamKeys(attributes);
            String defaultMsg = ExtNodeConstants.MSG_NODE_ATTRVALUE_HTML_PREFIX + msgElem.html();

            // TODO cache localed helper instance
            ParamMapResourceBundleHelper helper = null;
            if (attributes.hasKey(ExtNodeConstants.MSG_NODE_ATTR_LOCALE)) {
                helper = new ParamMapResourceBundleHelper(LocalizeUtil.getLocale(attributes.get(ExtNodeConstants.MSG_NODE_ATTR_LOCALE)));
            } else {
                helper = new ParamMapResourceBundleHelper();
            }

            Map<String, Object> paramMap = getMessageParams(attributes, helper, key, externalizeParamKeys);
View Full Code Here

TOP

Related Classes of org.jsoup.nodes.Attributes

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.