Package org.jsoup.nodes

Examples of org.jsoup.nodes.Attributes$Dataset


                // create the datum for the choice
                return String.format("{\"value\":\"%s\"}", choice);
            }
        };

        TypeaheadConfig config = new TypeaheadConfig(new DataSet(bloodhound));

        return new Typeahead<String>(id, Model.of(""), config);
    }
View Full Code Here


    }
    Element body = doc.select("body").first();
    if (session == 0) {
      session = System.currentTimeMillis();
      body.appendElement("br");
      Element sess = new Element(Tag.valueOf("div"), "", new Attributes());
      sess.addClass("session");
      sess.attr("id", String.valueOf(session));
      sess.append("Session started on " + new java.util.Date());
      body.appendChild(sess);
      body.appendElement("br");
      if (s.equals("")) {
        saveLogFile(doc);
        return;
      }
    }
    Element cursession = doc.select("#" + session).first();
    if (cursession == null)
      return;

    Element timestamp = new Element(Tag.valueOf("span"), "",
        new Attributes());
    timestamp.addClass("timestamp");
    if (!s.equals(""))
      timestamp.append(new java.util.Date().toString());

    String userNick = s.trim().split(" ")[0];

    if (s.startsWith("<" + this.getChannelName() + ">")
        || userNick.contains(".") || s.startsWith("<SYSTEM>")) {
      Element system = new Element(Tag.valueOf("div"), "",
          new Attributes());
      system.addClass("system");

      Element systemmsg = new Element(Tag.valueOf("span"), "",
          new Attributes());
      systemmsg.addClass("system-msg");
      systemmsg.append(s.replaceAll("<", "&lt;"));

      system.appendChild(timestamp);
      system.appendChild(systemmsg);

      body.appendChild(system);

    } else {
      // TODO use default user timestamp format
      // TODO format links and quicklinks in html log
      Element message = new Element(Tag.valueOf("div"), "",
          new Attributes());
      message.addClass("message" + (alternateMessage ? "-alt" : ""));

      Element nick = new Element(Tag.valueOf("span"), "",
          new Attributes());
      nick.addClass("nick"
          + (userNick.contains(getBot().getNick()) ? "-me" : ""));
      nick.append(userNick.replaceAll("<", "&lt;"));

      message.appendChild(timestamp);
View Full Code Here

        }
        return false;
    }

    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

        }
        return false;
    }

    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

    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

        boolean selfClosing = false;
        Attributes attributes; // start tags get attributes on construction. End tags get attributes on first new attribute (but only for parser convenience, not used).

        void newAttribute() {
            if (attributes == null)
                attributes = new Attributes();

            if (pendingAttributeName != null) {
                Attribute attribute;
                if (pendingAttributeValue == null)
                    attribute = new Attribute(pendingAttributeName, "");
View Full Code Here

    }

    static class StartTag extends Tag {
        StartTag() {
            super();
            attributes = new Attributes();
            type = TokenType.StartTag;
        }
View Full Code Here

public class LocalWebPageTest {
  @Test
  public void detectDojoScriptFromLocalFilePath() {
    LocalWebPage localWebPage = new LocalWebPage("");
   
    Attributes attrs = new Attributes();
    attrs.put("src", "dojo.js");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    assertTrue(localWebPage.isDojoScript(dojoScript));
  }
View Full Code Here

 
  @Test
  public void detectDojoScriptFromFullFilePath() {
    LocalWebPage localWebPage = new LocalWebPage("");
   
    Attributes attrs = new Attributes();
    attrs.put("src", "/some/folders/go/here/dojo.js");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    assertTrue(localWebPage.isDojoScript(dojoScript));
  }
View Full Code Here

 
  @Test
  public void detectDojoScriptWhenPathHasQueryParameters() {
    LocalWebPage localWebPage = new LocalWebPage("");
   
    Attributes attrs = new Attributes();
    attrs.put("src", "dojo.js?cachebust=true");   
   
    Element dojoScript = new Element(Tag.valueOf("script"), "", attrs);
   
    assertTrue(localWebPage.isDojoScript(dojoScript));
  }
View Full Code Here

TOP

Related Classes of org.jsoup.nodes.Attributes$Dataset

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.