/** Add all the attributes from the incoming set to this set. @param incoming attributes to add to these attributes. */ public void addAll(Attributes incoming) { if (incoming.size() == 0) return; checkCapacity(size + incoming.size); for (Attribute attr : incoming) { // todo - should this be case insensitive? put(attr); } }
@Override public String toString() { if (attributes != null && attributes.size() > 0) return "<" + name() + " " + attributes.toString() + ">"; else return "<" + name() + ">"; } }
private void getElements(Elements elements, List<Map<String, Object>> resultList) { for (Element element : elements) { Map<String, Object> result = new HashMap<>(); if(element.attributes().size() > 0) result.put("attributes", getAttributes(element)); if(!element.data().isEmpty())result.put("data", element.data()); if(element.hasText()) result.put("text", element.text()); if(!element.val().isEmpty()) result.put("value", element.val()); if(!element.tagName().isEmpty()) result.put("tagName", element.tagName()); resultList.add(result); } }
@Override public boolean matches(Element root, Element element) { return element.attributes().size() > 0; } }
@Override public boolean matches(Element root, Element element) { return element.attributes().size() > 0; } }
/** * @param attributes A list of attribs * @return Returns a mutable map parsed out of the attribute list */ public static Map<String, String> parseAttribs(Attributes attributes) { Map<String, String> attrs = new LinkedHashMap<String, String>(attributes.size() + 4); for (Attribute a : attributes.asList()) if (!SKIP_ATTR.contains(a.getKey())) attrs.put(a.getKey(), a.getValue()); return attrs; }
/** * @param attributes A list of attribs * @return Returns a mutable map parsed out of the attribute list */ public static Map<String, String> parseAttribs(Attributes attributes) { Map<String, String> attrs = new LinkedHashMap<String, String>(attributes.size() + 4); for (Attribute a : attributes.asList()) if (!SKIP_ATTR.contains(a.getKey())) attrs.put(a.getKey(), a.getValue()); return attrs; }
/** * @param attributes A list of attribs * @return Returns a mutable map parsed out of the attribute list */ static Map<String, String> parseAttribs(Attributes attributes) { Map<String, String> attrs = new LinkedHashMap<String, String>(attributes.size() + 4); for (Attribute a : attributes.asList()) if (SKIP_ATTR.contains(a.getKey())) continue; else attrs.put(a.getKey(), a.getValue()); return attrs; }