Attribute.getKey
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.jsoup.nodes.Attribute.getKey(Showing top 15 results out of 315)

origin: org.jsoup/jsoup

private void copyAttributes(org.jsoup.nodes.Node source, Element el) {
  for (Attribute attribute : source.attributes()) {
    // valid xml attribute names are: ^[a-zA-Z_:][-a-zA-Z0-9_:.]
    String key = attribute.getKey().replaceAll("[^-a-zA-Z0-9_:.]", "");
    if (key.matches("[a-zA-Z_:][-a-zA-Z0-9_:.]*"))
      el.setAttribute(key, attribute.getValue());
  }
}
origin: org.jsoup/jsoup

@Override
public boolean matches(Element root, Element element) {
  List<org.jsoup.nodes.Attribute> values = element.attributes().asList();
  for (org.jsoup.nodes.Attribute attribute : values) {
    if (lowerCase(attribute.getKey()).startsWith(keyPrefix))
      return true;
  }
  return false;
}
origin: stackoverflow.com

 Document doc = Jsoup.parseBodyFragment(aText);
Elements el = doc.getAllElements();
for (Element e : el) {
  Attributes at = e.attributes();
  for (Attribute a : at) {
    e.removeAttr(a.getKey());
  }
}
if(Jsoup.isValid(doc.body().html(), theLegalWhitelist))
  return true;
else
  return false;
origin: com.google.sitebricks/sitebricks

/**
 * @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;
}
origin: Cognifide/knotx

public ServiceEntry(Attribute serviceAttribute, Attribute paramsAttribute) {
 this.namespace = ServiceAttributeUtil.extractNamespace(serviceAttribute.getKey());
 this.name = serviceAttribute.getValue();
 this.params = getParams(paramsAttribute);
 this.cacheKey = String.format("%s|%s", getName(), getParams());
}
origin: vsch/flexmark-java

public void dumpHtmlTree(FormattingAppendable out, Node node) {
  out.line().append(node.nodeName());
  for (Attribute attribute : node.attributes().asList()) {
    out.append(' ').append(attribute.getKey()).append("=\"").append(attribute.getValue()).append("\"");
  }
  out.line().indent();
  for (Node child : node.childNodes()) {
    dumpHtmlTree(out, child);
  }
  out.unIndent();
}
origin: org.jsoup/jsoup

private void getWholeDeclaration(Appendable accum, Document.OutputSettings out) throws IOException {
  for (Attribute attribute : attributes()) {
    if (!attribute.getKey().equals(nodeName())) { // skips coreValue (name)
      accum.append(' ');
      attribute.html(accum, out);
    }
  }
}
origin: astamuse/asta4d

  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());
    }
  }
}
origin: org.jsoup/jsoup

  public void remove() {
    attributes.remove(attr.getKey());
  }
}
origin: Cognifide/knotx

 private static Map<String, String> getSignalToUrlMapping(Document scriptDocument) {
  return scriptDocument.getElementsByAttributeStarting(FORM_SIGNAL_ATTR_PREFIX).stream()
    .flatMap(element -> element.attributes().asList().stream())
    .filter(allAttr -> allAttr.getKey().startsWith(FORM_SIGNAL_ATTR_PREFIX))
    .collect(Collectors.toMap(e -> e.getKey().replace(FORM_SIGNAL_ATTR_PREFIX, StringUtils.EMPTY),
      Entry::getValue));
 }
}
origin: Axellience/vue-gwt

private boolean isEventBinding(Attribute attribute)
{
  String attributeName = attribute.getKey().toLowerCase();
  return attributeName.startsWith("@") || attributeName.startsWith("v-on:");
}
origin: Cognifide/knotx

private void clearFromActionAttributes(Element item) {
 item.attributes().asList().stream()
   .filter(attr -> attr.getKey().matches(ACTION_FORM_ATTRIBUTES_PATTERN))
   .forEach(attr -> item.removeAttr(attr.getKey()));
}
origin: GistLabs/mechanize

  public static List<String> getAttributeNamesForJSoupElement(Element element) {
    List<String> result = Util.newEmptyList();
    
    for(Attribute attribute : element.attributes())
      result.add(attribute.getKey());
    
    result.add(HtmlSpecialAttributes.SPECIAL_ATTRIBUTE_CLASS_NAMES);
    result.add(HtmlSpecialAttributes.SPECIAL_ATTRIBUTE_HTML);
    result.add(HtmlSpecialAttributes.SPECIAL_ATTRIBUTE_INNER_HTML);
    result.add(HtmlSpecialAttributes.SPECIAL_ATTRIBUTE_TAG_NAME);
    result.add(HtmlSpecialAttributes.SPECIAL_ATTRIBUTE_TEXT);
    
    return result;
  }
}
origin: org.jsoup/jsoup

/**
 Set a new attribute, or replace an existing one by key.
 @param attribute attribute with case sensitive key
 @return these attributes, for chaining
 */
public Attributes put(Attribute attribute) {
  Validate.notNull(attribute);
  put(attribute.getKey(), attribute.getValue());
  attribute.parent = this;
  return this;
}
origin: Axellience/vue-gwt

private boolean isAttributeBinding(Attribute attribute)
{
  String attributeName = attribute.getKey().toLowerCase();
  return attributeName.startsWith(":") || attributeName.startsWith("v-bind:");
}
org.jsoup.nodesAttributegetKey

Javadoc

Get the attribute key.

Popular methods of Attribute

  • getValue
    Get the attribute value.
  • <init>
    Create a new attribute from unencoded (raw) key and value.
  • createFromEncoded
    Create a new Attribute from an unencoded key and a HTML attribute encoded value.
  • setValue
    Set the attribute value.
  • html
  • isBooleanAttribute
    Checks if this attribute name is defined as a boolean attribute in HTML5
  • isDataAttribute
  • shouldCollapseAttribute
    Collapsible if it's a boolean attribute and value is empty or same as name
  • toString
    Get the string representation of this attribute, implemented as #html().

Popular classes and methods

  • getContentResolver (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getSupportFragmentManager (FragmentActivity)
  • String (java.lang)
    An immutable sequence of characters/code units ( chars). A String is represented by array of UTF-16
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Path (java.nio.file)
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)