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

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

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

Attribute.clone介绍

暂无

代码示例

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

for(int i = 0; i < attributes.size(); i++) {
  final Attribute attribute = attributes.get(i);
  element.attributes.add(attribute.clone());

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

private static String attribute2text(Attribute attribute) {
  Element x = new Element("x").setAttribute(attribute.clone());
  String text = element2text(x);
  return text.substring(3, text.length() - 2).trim();
}

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

/**
 * Copies those attributes from the other's element into this' element that do not exist in this' element.
 */
protected void mergeAttributes(MCRMerger other) {
  for (Attribute attribute : other.element.getAttributes()) {
    if (this.element.getAttribute(attribute.getName(), attribute.getNamespace()) == null) {
      this.element.setAttribute(attribute.clone());
    }
  }
}

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

/**
 * Merges the publication data returned by the data source with the existing data
 */
void mergeResultWith(Element existingData) {
  if (existingData.getName().equals("relatedItem")) {
    // resolved is always mods:mods, transform to mods:relatedItem to be mergeable
    result.setName("relatedItem");
    result.setAttribute(existingData.getAttribute("type").clone());
  }
  MCRMerger a = MCRMergerFactory.buildFrom(existingData);
  MCRMerger b = MCRMergerFactory.buildFrom(result);
  a.mergeFrom(b);
}

代码示例来源:origin: Vhati/Slipstream-Mod-Manager

handled = true;
for ( Attribute attrib : cmdNode.getAttributes() ) {
  contextNode.setAttribute( attrib.clone() );

代码示例来源:origin: org.jetbrains.intellij.plugins/intellij-plugin-structure

private Element resolveNonXIncludeElement(Element original, Stack<String> bases) throws XIncludeException {
 Element result = new Element(original.getName(), original.getNamespace());
 for (Attribute a : original.getAttributes()) {
  result.setAttribute(a.clone());
 }
 for (Content o : original.getContent()) {
  if (o instanceof Element) {
   Element element = (Element) o;
   if (isIncludeElement(element)) {
    result.addContent(resolveXIncludeElement(element, bases));
   } else {
    result.addContent(resolveNonXIncludeElement(element, bases));
   }
  } else {
   result.addContent(o.clone());
  }
 }
 return result;
}

相关文章