@Test public void testAddAttribute() { Element e = new Element(Tag.valueOf("p"), ""); MarkupUtils.addAttribute(e, "key", "value1"); assert (MarkupUtils.getAttribute(e, "key").contains("value1")); MarkupUtils.addAttribute(e, "key", "value2"); assert (MarkupUtils.getAttribute(e, "key").contains("value1")); assert (MarkupUtils.getAttribute(e, "key").contains("value2")); assert (MarkupUtils.getAttributes(e, "key").contains("value1")); assert (MarkupUtils.getAttributes(e, "key").contains("value2")); }
public static void addAttribute(Element e, String key, String value) { String fullKey = attributeKey(key); String current = e.attr(fullKey); if (Strings.isNullOrEmpty(current)) { current = value; } else { current = concatenateAttribute(current, value); } e.attr(fullKey, current); }
MarkupUtils { public static void addAttribute(Element e, String key, String value) { String fullKey = attributeKey(key); String current = e.attr(fullKey); if (Strings.isNullOrEmpty(current)) { current = value; } else { current = concatenateAttribute(current, value); } e.attr(fullKey, current); } }
MarkupUtils { public static void addAttribute(Element e, String key, String value) { String fullKey = attributeKey(key); String current = e.attr(fullKey); if (Strings.isNullOrEmpty(current)) { current = value; } else { current = concatenateAttribute(current, value); } e.attr(fullKey, current); } private  MarkupUtils(); }
MarkupUtils { public static void addAttribute(Element e, String key, String value) { String fullKey = attributeKey(key); String current = e.attr(fullKey); if (Strings.isNullOrEmpty(current)) { current = value; } else { current = concatenateAttribute(current, value); } e.attr(fullKey, current); } private  MarkupUtils(); static void additionallyAnnotateAsType(Element e, String type); static void setAttribute(Element e, String key, String value); static void addAttribute(Element e, String key, String value); static String getAttribute(Element e, String key); static List<String> getAttributes(Element e, String key); static Set<String> getTypes(Element element); }
MarkupUtils { public static void addAttribute(Element e, String key, String value) { String fullKey = attributeKey(key); String current = e.attr(fullKey); if (Strings.isNullOrEmpty(current)) { current = value; } else { current = concatenateAttribute(current, value); } e.attr(fullKey, current); } private  MarkupUtils(); static void additionallyAnnotateAsType(Element e, String type); static void setAttribute(Element e, String key, String value); static void addAttribute(Element e, String key, String value); static String getAttribute(Element e, String key); static List<String> getAttributes(Element e, String key); static Set<String> getTypes(Element element); static final String ATTRIBUTE_VALUE_SEPARATOR; }