Codota Logo
Attributes.get
Code IndexAdd Codota to your IDE (free)

How to use
get
method
in
org.jsoup.nodes.Attributes

Best Java code snippets using org.jsoup.nodes.Attributes.get (Showing top 20 results out of 315)

  • Common ways to obtain Attributes
private void myMethod () {
Attributes a =
  • Codota IconElement design;design.attributes()
  • Codota Iconnew Attributes()
  • Codota IconNode node;node.attributes()
  • Smart code suggestions by Codota
}
origin: org.jsoup/jsoup

/**
 Set the attribute value.
 @param val the new attribute value; must not be null
 */
public String setValue(String val) {
  String oldVal = parent.get(this.key);
  if (parent != null) {
    int i = parent.indexOfKey(this.key);
    if (i != Attributes.NotFound)
      parent.vals[i] = val;
  }
  this.val = val;
  return oldVal;
}
origin: org.jsoup/jsoup

@Override
public String put(String key, String value) {
  String dataKey = dataKey(key);
  String oldValue = attributes.hasKey(dataKey) ? attributes.get(dataKey) : null;
  attributes.put(dataKey, value);
  return oldValue;
}
origin: org.jsoup/jsoup

  return tb.process(t, InHead);
} else if (name.equals("input")) {
  if (!startTag.attributes.get("type").equalsIgnoreCase("hidden")) {
    return anythingElse(t, tb);
  } else {
origin: org.jsoup/jsoup

if (startTag.attributes.hasKey("action")) {
  Element form = tb.getFormElement();
  form.attr("action", startTag.attributes.get("action"));
    startTag.attributes.get("prompt") :
    "This is a searchable index. Enter search keywords: ";
origin: com.vaadin/vaadin-server

@Override
public void readDesign(Element design, DesignContext designContext) {
  // process default attributes
  super.readDesign(design, designContext);
  // handle children
  for (Element childComponent : design.children()) {
    Attributes attr = childComponent.attributes();
    Component newChild = designContext.readDesign(childComponent);
    StringBuilder css = new StringBuilder();
    if (attr.hasKey(ATTR_TOP)) {
      css.append("top:").append(attr.get(ATTR_TOP)).append(';');
    }
    if (attr.hasKey(ATTR_RIGHT)) {
      css.append("right:").append(attr.get(ATTR_RIGHT)).append(';');
    }
    if (attr.hasKey(ATTR_BOTTOM)) {
      css.append("bottom:").append(attr.get(ATTR_BOTTOM)).append(';');
    }
    if (attr.hasKey(ATTR_LEFT)) {
      css.append("left:").append(attr.get(ATTR_LEFT)).append(';');
    }
    if (attr.hasKey(ATTR_Z_INDEX)) {
      css.append("z-index:").append(attr.get(ATTR_Z_INDEX))
          .append(';');
    }
    addComponent(newChild, css.toString());
  }
}
origin: vsch/flexmark-java

void processAttributes(Node node) {
  Attributes attributes = myState.myAttributes;
  if (myOptions.outputAttributesIdAttr || !myOptions.outputAttributesNamesRegex.isEmpty()) {
    final org.jsoup.nodes.Attributes nodeAttributes = node.attributes();
    boolean idDone = false;
    if (myOptions.outputAttributesIdAttr) {
      String id = nodeAttributes.get("id");
      if (id == null || id.isEmpty()) {
        id = nodeAttributes.get("name");
      }
      if (id != null && !id.isEmpty()) {
        attributes.replaceValue("id", id);
        idDone = true;
      }
    }
    if (!myOptions.outputAttributesNamesRegex.isEmpty()) {
      for (org.jsoup.nodes.Attribute attribute : nodeAttributes) {
        if (idDone && (attribute.getKey().equals("id") || attribute.getKey().equals("name"))) {
          continue;
        }
        if (attribute.getKey().matches(myOptions.outputAttributesNamesRegex)) {
          attributes.replaceValue(attribute.getKey(), attribute.getValue());
        }
      }
    }
  }
}
origin: com.vaadin/vaadin-server

@Override
public void readDesign(Element design, DesignContext designContext) {
  super.readDesign(design, designContext);
  Attributes attributes = design.attributes();
  if (design.hasAttr("color")) {
    // Ignore the # character
    String hexColor = DesignAttributeHandler
        .readAttribute("color", attributes, String.class)
        .substring(1);
    doSetValue(new Color(Integer.parseInt(hexColor, 16)));
  }
  if (design.hasAttr("popup-style")) {
    setPopupStyle(PopupStyle.valueOf("POPUP_"
        + attributes.get("popup-style").toUpperCase(Locale.ROOT)));
  }
  if (design.hasAttr("position")) {
    String[] position = attributes.get("position").split(",");
    setPosition(Integer.parseInt(position[0]),
        Integer.parseInt(position[1]));
  }
}
origin: com.vaadin/vaadin-server

if (attributes.hasKey("name")
    && attributes.hasKey("content") && "package-mapping"
        .equals(attributes.get("name"))) {
  String contentString = attributes.get("content");
  String[] parts = contentString.split(":");
  if (parts.length != 2) {
origin: com.vaadin/vaadin-server

/**
 * Reads the given attribute from a set of attributes.
 *
 * @param attribute
 *            the attribute key
 * @param attributes
 *            the set of attributes to read from
 * @param outputType
 *            the output type for the attribute
 * @return the attribute value or null
 */
public static <T> T readAttribute(String attribute, Attributes attributes,
    Class<T> outputType) {
  if (!getFormatter().canConvert(outputType)) {
    throw new IllegalArgumentException(
        "output type: " + outputType.getName() + " not supported");
  }
  if (!attributes.hasKey(attribute)) {
    return null;
  } else {
    try {
      String value = attributes.get(attribute);
      return getFormatter().parse(value, outputType);
    } catch (Exception e) {
      throw new DesignException(
          "Failed to read attribute " + attribute, e);
    }
  }
}
origin: com.vaadin/vaadin-server

setLocale(getLocaleFromString(attr.get("locale")));
UserError error = new UserError(attr.get("error"),
    com.vaadin.server.AbstractErrorMessage.ContentMode.HTML,
    ErrorLevel.ERROR);
origin: com.vaadin/vaadin-server

@Override
public void readDesign(Element design, DesignContext designContext) {
  // process default attributes
  super.readDesign(design, designContext);
  setMargin(readMargin(design, getMargin(), designContext));
  // handle children
  for (Element childComponent : design.children()) {
    Attributes attr = childComponent.attributes();
    Component newChild = designContext.readDesign(childComponent);
    addComponent(newChild);
    // handle alignment
    setComponentAlignment(newChild,
        DesignAttributeHandler.readAlignment(attr));
    // handle expand ratio
    if (attr.hasKey(":expand")) {
      String value = attr.get(":expand");
      if (!value.isEmpty()) {
        try {
          float ratio = Float.valueOf(value);
          setExpandRatio(newChild, ratio);
        } catch (NumberFormatException nfe) {
          getLogger()
              .info("Failed to parse expand ratio " + value);
        }
      } else {
        setExpandRatio(newChild, 1.0f);
      }
    }
  }
}
origin: com.vaadin/vaadin-server

/**
 * Reads the size of this component from the given design attributes. If the
 * attributes do not contain relevant size information, defaults is
 * consulted.
 *
 * @param attributes
 *            the design attributes
 */
private void readSize(Attributes attributes) {
  // read width
  if (attributes.hasKey("width-auto") || attributes.hasKey("size-auto")) {
    this.setWidth(null);
  } else if (attributes.hasKey("width-full")
      || attributes.hasKey("size-full")) {
    this.setWidth("100%");
  } else if (attributes.hasKey("width")) {
    this.setWidth(attributes.get("width"));
  }
  // read height
  if (attributes.hasKey("height-auto")
      || attributes.hasKey("size-auto")) {
    this.setHeight(null);
  } else if (attributes.hasKey("height-full")
      || attributes.hasKey("size-full")) {
    this.setHeight("100%");
  } else if (attributes.hasKey("height")) {
    this.setHeight(attributes.get("height"));
  }
}
origin: com.vaadin/vaadin-server

String localId = attributes.get(LOCAL_ID_ATTRIBUTE);
boolean mappingExists = setComponentLocalId(component, localId);
if (mappingExists) {
origin: org.apache.james/james-server-jmap

private String generateImageAlternativeText(Element element) {
  return Optional.ofNullable(element.attributes().get(ALT_TAG))
    .map(StringUtils::normalizeSpace)
    .filter(s -> !s.isEmpty())
    .map(s -> "[" + s + "]")
    .orElse("");
}
origin: GistLabs/mechanize

@Override
public String getAttribute(final Node node, final String name) {
  return node.attributes().get(name).trim();
}
origin: org.kantega.openaksess/openaksess-core

private NodeWrapper(Node wrapped) {
  this.wrapped = wrapped;
  Attributes attributes = wrapped.attributes();
  if (nonNull(attributes)) {
    String value = attributes.get("class");
    if (nonNull(value)) {
      value = whitespace.matcher(value).replaceAll(" ");
      String[] split = value.split(" ");
      Arrays.sort(split);
      classAttribute = join(split, " ");
    }
    value = attributes.get("style");
    if (nonNull(value)) {
      value = whitespace.matcher(value).replaceAll(" ");
      String[] split = value.split(";");
      Arrays.sort(split);
      styleAttribute = join(split, ";");
    }
  }
}
origin: UNIVALI-LITE/Portugol-Studio

  public void extrair(String html, String nomeArquivo) throws ErroCarregamentoAjuda
  {
    Document documento = Jsoup.parse(html);
    
    for (Element tag : documento.head().getElementsByTag("title"))
    {
      titulo = tag.text();
    }
    
    for (Element tag : documento.head().getElementsByTag("link"))
    {
      String rel = tag.attributes().get("rel");
      
      if (rel != null && rel.toLowerCase().equals("shortcut icon"))
      {
        icone = tag.attributes().get("href");
        break;
      }
    }
    
    if (titulo == null)
    {
      throw new ErroCarregamentoAjuda(String.format("Erro ao carregar a ajuda: o arquivo '%s' não possui a tag 'title'", nomeArquivo));
    }
    
  }
}
origin: rubenlagus/TelegramBotsExample

private List<RaeResult> findResultsFromRedirect(Element element, String word) {
  List<RaeResult> results = new ArrayList<>();
  Element redirect = element.getElementsByTag("a").first();
  if (redirect != null) {
    String link = redirect.attributes().get("href");
    results = fetchWord(link, word);
  }
  return results;
}
origin: com.vaadin/vaadin-compatibility-server

@Override
public void readDesign(Element design, DesignContext designContext) {
  super.readDesign(design, designContext);
  Attributes attributes = design.attributes();
  if (design.hasAttr("color")) {
    // Ignore the # character
    String hexColor = DesignAttributeHandler
        .readAttribute("color", attributes, String.class)
        .substring(1);
    setColor(new Color(Integer.parseInt(hexColor, 16)));
  }
  if (design.hasAttr("popup-style")) {
    setPopupStyle(PopupStyle.valueOf("POPUP_"
        + attributes.get("popup-style").toUpperCase(Locale.ROOT)));
  }
  if (design.hasAttr("position")) {
    String[] position = attributes.get("position").split(",");
    setPosition(Integer.parseInt(position[0]),
        Integer.parseInt(position[1]));
  }
}
origin: com.vaadin/vaadin-compatibility-server

@Override
public void readDesign(Element design, DesignContext designContext) {
  super.readDesign(design, designContext);
  Attributes attr = design.attributes();
  // handle immediate
  if (attr.hasKey("immediate")) {
    setImmediate(DesignAttributeHandler.getFormatter()
        .parse(attr.get("immediate"), Boolean.class));
  }
}
org.jsoup.nodesAttributesget

Javadoc

Get an attribute value by key.

Popular methods of Attributes

  • asList
    Get the attributes as a List, for iteration.
  • hasKey
    Tests if these attributes contain an attribute with this key.
  • put
  • <init>
  • size
    Get the number of attributes in this set.
  • addAll
    Add all the attributes from the incoming set to this set.
  • getIgnoreCase
    Get an attribute's value by case-insensitive key
  • html
  • clone
  • equals
    Checks if these attributes are equal to another set of attributes, by comparing the two sets
  • forEach
  • iterator
  • forEach,
  • iterator,
  • remove,
  • add,
  • checkCapacity,
  • checkNotNull,
  • copyOf,
  • dataset,
  • hasKeyIgnoreCase

Popular in Java

  • Updating database using SQL prepared statement
  • getContentResolver (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now