org.jdom2.Attribute.setValue()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中org.jdom2.Attribute.setValue()方法的一些代码示例,展示了Attribute.setValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.setValue()方法的具体详情如下:
包路径:org.jdom2.Attribute
类名称:Attribute
方法名:setValue

Attribute.setValue介绍

[英]This will set the value of the Attribute.
[中]这将设置Attribute的值。

代码示例

代码示例来源:origin: gocd/gocd

for (Element element : encryptedPasswordElements) {
  Attribute encryptedPassword = element.getAttribute(attributeName);
  encryptedPassword.setValue(reEncryptUsingNewKey(decodeHex(oldCipher), decodeHex(newCipher), encryptedPassword.getValue()));
  LOGGER.debug("Replaced encrypted value at {}", element.toString());

代码示例来源:origin: org.jdom/jdom

/**
 * <p>
 * This sets an attribute value for this element.  Any existing attribute
 * with the same name and namespace URI is removed.
 * </p>
 *
 * @param name name of the attribute to set
 * @param value value of the attribute to set
 * @return this element modified
 * @throws IllegalNameException if the given name is illegal as an
 *         attribute name.
 * @throws IllegalDataException if the given attribute value is
 *         illegal character data (as determined by
 *         {@link org.jdom2.Verifier#checkCharacterData}).
 */
public Element setAttribute(final String name, final String value) {
  final Attribute attribute = getAttribute(name);
  if (attribute == null) {
    final Attribute newAttribute = new Attribute(name, value);
    setAttribute(newAttribute);
  } else {
    attribute.setValue(value);
  }
  return this;
}

代码示例来源:origin: org.jdom/jdom

/**
 * This will create a new <code>Attribute</code> with the
 * specified (local) name, value, and type, and in the provided
 * <code>{@link Namespace}</code>.
 *
 * @param name <code>String</code> name of <code>Attribute</code>.
 * @param value <code>String</code> value for new attribute.
 * @param type <code>AttributeType</code> for new attribute.
 * @param namespace <code>Namespace</code> namespace for new attribute.
 * @throws IllegalNameException if the given name is illegal as an
 *         attribute name or if if the new namespace is the default
 *         namespace. Attributes cannot be in a default namespace.
 * @throws IllegalDataException if the given attribute value is
 *         illegal character data (as determined by
 *         {@link org.jdom2.Verifier#checkCharacterData}) or
 *         if the given attribute type is not one of the
 *         supported types.
 */
public Attribute(final String name, final String value, final AttributeType type, final Namespace namespace) {
  setName(name);
  setValue(value);
  setAttributeType(type);
  setNamespace(namespace);
}

代码示例来源:origin: org.jdom/jdom

/**
 * <p>
 * This sets an attribute value for this element.  Any existing attribute
 * with the same name and namespace URI is removed.
 * </p>
 *
 * @param name name of the attribute to set
 * @param value value of the attribute to set
 * @param ns namespace of the attribute to set. A null implies Namespace.NO_NAMESPACE.
 * @return this element modified
 * @throws IllegalNameException if the given name is illegal as an
 *         attribute name, or if the namespace is an unprefixed default
 *         namespace
 * @throws IllegalDataException if the given attribute value is
 *         illegal character data (as determined by
 *         {@link org.jdom2.Verifier#checkCharacterData}).
 * @throws IllegalAddException if the attribute namespace prefix
 *         collides with another namespace prefix on the element.
 */
public Element setAttribute(final String name, final String value, final Namespace ns) {
  final Attribute attribute = getAttribute(name, ns);
  if (attribute == null) {
    final Attribute newAttribute = new Attribute(name, value, ns);
    setAttribute(newAttribute);
  } else {
    attribute.setValue(value);
  }
  return this;
}

代码示例来源:origin: org.mycore/mycore-xeditor

public static MCRChangeData setValue(Attribute attribute, String value) {
  MCRChangeData data = new MCRChangeData("set-attribute", attribute);
  attribute.setValue(value);
  return data;
}

代码示例来源:origin: com.xebialabs.cloud/overcast

/**
 * update the disks in the domain XML. It is assumed that the the size of the volumes is the same as the number of
 * disk elements and that the order is the same.
 */
public static void updateDisks(Document domainXml, List<StorageVol> volumes) throws LibvirtException {
  XPathFactory xpf = XPathFactory.instance();
  XPathExpression<Element> diskExpr = xpf.compile(XPATH_DISK, Filters.element());
  XPathExpression<Attribute> fileExpr = xpf.compile(XPATH_DISK_FILE, Filters.attribute());
  List<Element> disks = diskExpr.evaluate(domainXml);
  Iterator<StorageVol> cloneDiskIter = volumes.iterator();
  for (Element disk : disks) {
    Attribute file = fileExpr.evaluateFirst(disk);
    StorageVol cloneDisk = cloneDiskIter.next();
    file.setValue(cloneDisk.getPath());
  }
}

代码示例来源:origin: org.apache.jspwiki/jspwiki-main

hrefAttr.setValue( newHref.replaceFirst( LINKS_SOURCE, LINKS_TRANSLATION ) );
newHref = m_context.getEngine().decodeName( newHref );
hrefAttr.setValue( newHref );

代码示例来源:origin: io.wcm.tooling.commons/io.wcm.tooling.commons.crx-packmgr-helper

attribute.setValue(filteredValue);
attribute.setValue(sortWeakReferenceValues(attribute.getQualifiedName(), attribute.getValue()));

相关文章