org.jdom.Element.removeAttribute()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(140)

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

Element.removeAttribute介绍

[英]This removes the attribute with the given name and within no namespace. If no such attribute exists, this method does nothing.
[中]这将删除具有给定名称且不在名称空间内的属性。如果不存在此类属性,则此方法不执行任何操作。

代码示例

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

/**
 * <p>
 * This removes the attribute with the given name and within no
 * namespace. If no such attribute exists, this method does nothing.
 * </p>
 *
 * @param name name of attribute to remove
 * @return whether the attribute was removed
 */
public boolean removeAttribute(final String name) {
  return removeAttribute(name, Namespace.NO_NAMESPACE);
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

public boolean removeAttribute(String name)
{
  return element.removeAttribute(name);
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

public boolean removeAttribute(String name, Namespace ns)
{
  return element.removeAttribute(name, ns);
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

public boolean removeAttribute(Attribute attribute)
{
  return element.removeAttribute(attribute);
}

代码示例来源:origin: javasoze/meaningfulweb

private void removeProcessingAttributes(Element elem) {
 elem.removeAttribute(TEXT_SIZE);
 elem.removeAttribute(TOTAL_TEXT_SIZE);
 elem.removeAttribute(TOTAL_TEXT_IN_LINKS);
 elem.removeAttribute(TEXT_SIZE_SCORE);
 elem.removeAttribute(TOTAL_NODES);
 elem.removeAttribute(TOTAL_ELEMENT_NODES);
 elem.removeAttribute(TOTAL_TEXT_NODES);
 elem.removeAttribute(TOTAL_LINKS);
 elem.removeAttribute(TOTAL_PTAGS);
 elem.removeAttribute(TOTAL_H1TAGS);
 elem.removeAttribute(TOTAL_IMAGES);
 elem.removeAttribute(HAS_DIRECT_TEXT);
 elem.removeAttribute(TEXT_NODE_SCORE);
 elem.removeAttribute(LINK_SCORE);
 elem.removeAttribute(LEVEL);
 elem.removeAttribute(TOTAL_LEVELS);
 elem.removeAttribute(POSITION);
}

代码示例来源:origin: commons-jxpath/commons-jxpath

public void remove() {
  attr.getParent().removeAttribute(attr);
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Sets the @isSynthetic flag of the method.
 */
public void setSynthetic(boolean flag)
{
  if (flag)
  {
    methodElement.setAttribute("isSynthetic", "true");
  }
  else
  {
    methodElement.removeAttribute("isSynthetic");
  }
}

代码示例来源:origin: org.biomoby/taverna-biomoby

/**
 * 
 * @param newName
 *            the new name for this fully wrapped BioMOBY collection
 * @param element
 *            the fully wrapped BioMOBY collection
 * @return @return an element 'Collection' representing the renamed collection
 * @throws MobyException
 *             if the message is invalid
 */
public static Element renameCollection(String newName, Element element)
    throws MobyException {
  Element e = (Element) element.clone();
  Element mobyData = extractMobyData(e);
  Element coll = mobyData.getChild("Collection");
  if (coll == null)
    coll = mobyData.getChild("Collection", MOBY_NS);
  if (coll == null)
    return e;
  coll.removeAttribute("articleName");
  coll.removeAttribute("articleName", MOBY_NS);
  coll.setAttribute("articleName", newName, MOBY_NS);
  return coll;
}

代码示例来源:origin: org.biomoby/taverna-biomoby

temp.removeAttribute("queryID");
temp.removeAttribute("queryID", MOBY_NS);
temp.setAttribute("queryID", (id == null || id == "" ? "a"
    + queryCount++ : id), MOBY_NS);

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

/**
 * This detaches the <code>Attribute</code> from its parent, or does
 * nothing if the <code>Attribute</code> has no parent.
 *
 * @return <code>Attribute</code> - this <code>Attribute</code> modified.
 */
public Attribute detach() {
  final Element parentElement = getParent();
  if (parentElement != null) {
    parentElement.removeAttribute(getName(),getNamespace());
  }
  return this;
}

代码示例来源:origin: org.biomoby/taverna-biomoby

/**
 * 
 * @param oldName
 * @param newName
 * @param type
 * @param element
 * @return
 * @throws MobyException
 */
public static Element renameSimple(String newName, String type,
    Element element) throws MobyException {
  Element e = (Element) element.clone();
  Element mobyData = extractMobyData(e);
  String queryID = getQueryID(e);
  Element serviceNotes = getServiceNotes(e);
  Element simple = mobyData.getChild("Simple");
  if (simple == null)
    simple = mobyData.getChild("Simple", MOBY_NS);
  if (simple == null) {
    return e;
  }
  simple.removeAttribute("articleName");
  simple.removeAttribute("articleName", MOBY_NS);
  simple.setAttribute("articleName", newName, MOBY_NS);
  return createMobyDataElementWrapper(simple, queryID, serviceNotes);
}

代码示例来源:origin: net.sf.taverna.cagrid/cagrid-wsdl-generic

private static Element constructElementForComplexType(
    ComplexTypeDescriptor descriptor, List<String> existingsTypes) {
  Element result = new Element("complextype", XScuflNS);
  if (existingsTypes.contains(descriptor.getQname().toString())) {
    result.setAttribute("id", descriptor.getQname().toString());
    populateElement(result, descriptor);
    result.removeAttribute("qname");
  } else {
    existingsTypes.add(descriptor.getQname().toString());
    populateElement(result, descriptor);
    Element elements = new Element("elements", XScuflNS);
    for (TypeDescriptor desc : descriptor.getElements()) {
      Element element = null;
      if (desc instanceof ComplexTypeDescriptor) {
        element = constructElementForComplexType(
            (ComplexTypeDescriptor) desc, existingsTypes);
      } else if (desc instanceof ArrayTypeDescriptor) {
        element = constructElementForArrayType(
            (ArrayTypeDescriptor) desc, existingsTypes);
      } else if (desc instanceof BaseTypeDescriptor) {
        element = new Element("basetype", XScuflNS);
        populateElement(element, desc);
      }
      if (element != null)
        elements.addContent(element);
    }
    result.addContent(elements);
  }
  return result;
}

代码示例来源:origin: net.sf.taverna.cagrid/cagrid-wsdl-generic

private static Element constructElementForArrayType(
    ArrayTypeDescriptor descriptor, List<String> existingsTypes) {
  Element result = new Element("arraytype", XScuflNS);
  if (existingsTypes.contains(descriptor.getQname().toString())) {
    result.setAttribute("id", descriptor.getQname().toString());
    populateElement(result, descriptor);
    result.removeAttribute("qname");
  } else {
    existingsTypes.add(descriptor.getQname().toString());
    populateElement(result, descriptor);
    Element elementType = new Element("elementtype", XScuflNS);
    if (descriptor.getElementType() instanceof ComplexTypeDescriptor) {
      elementType.addContent(constructElementForComplexType(
          (ComplexTypeDescriptor) descriptor.getElementType(),
          existingsTypes));
    } else if (descriptor.getElementType() instanceof ArrayTypeDescriptor) {
      elementType.addContent(constructElementForArrayType(
          (ArrayTypeDescriptor) descriptor.getElementType(),
          existingsTypes));
    } else if (descriptor.getElementType() instanceof BaseTypeDescriptor) {
      Element element = new Element("basetype", XScuflNS);
      populateElement(element, descriptor.getElementType());
      elementType.addContent(element);
    }
    result.addContent(elementType);
  }
  return result;
}

代码示例来源:origin: uk.org.mygrid.taverna/taverna-scavenger-ui

for (Iterator i = attributes.iterator(); i.hasNext();) {
  Attribute att = (Attribute) i.next();
  processorElement.removeAttribute(att);

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

public void populateItem(Item item, Element eItem, int index) {
  super.populateItem(item,eItem, index);
  Element eDescription = eItem.getChild("description",getFeedNamespace());
  if (eDescription != null) eDescription.removeAttribute("type");
  String author = item.getAuthor();
  if (author != null) {
    eItem.addContent(generateSimpleElement("author", author));
  }
  String comments = item.getComments();
  if (comments != null) {
    eItem.addContent(generateSimpleElement("comments", comments));
  }
  Guid guid = item.getGuid();
  if (guid != null) {
    Element eGuid = generateSimpleElement("guid",guid.getValue());
    if (!guid.isPermaLink()) {
      eGuid.setAttribute("isPermaLink", "false");
    }
    eItem.addContent(eGuid);
  }
}

代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication

public void populateItem(Item item, Element eItem, int index) {
  super.populateItem(item,eItem, index);
  Element eDescription = eItem.getChild("description",getFeedNamespace());
  if (eDescription != null) eDescription.removeAttribute("type");
  String author = item.getAuthor();
  if (author != null) {
    eItem.addContent(generateSimpleElement("author", author));
  }
  String comments = item.getComments();
  if (comments != null) {
    eItem.addContent(generateSimpleElement("comments", comments));
  }
  Guid guid = item.getGuid();
  if (guid != null) {
    Element eGuid = generateSimpleElement("guid",guid.getValue());
    if (!guid.isPermaLink()) {
      eGuid.setAttribute("isPermaLink", "false");
    }
    eItem.addContent(eGuid);
  }
}

代码示例来源:origin: apache/oozie

private Element createActionElement(String actionXml) throws JDOMException, ParseException {
  Element eAction = XmlUtils.parseXml(actionXml);
  eAction.removeAttribute("start");
  eAction.removeAttribute("end");
  eAction.setAttribute("instance-number", Integer.toString(1));
  eAction.setAttribute("action-nominal-time",
      DateUtils.formatDateOozieTZ(DateUtils.parseDateOozieTZ("2009-09-08T01:00Z")));
  eAction.setAttribute("action-actual-time", DateUtils.formatDateOozieTZ(new Date()));
  return eAction;
}

代码示例来源:origin: com.ebmwebsourcing.easybpel/easybpel.model.bpel.impl

private String affectTextElementOrAttributeValueInRightSide(
    final Element rightSide) {
  String value = "";
  final Attribute workOnAttribute = rightSide.getAttribute("workOnAttribute", Namespace.getNamespace("meta_ebm", "http://com.ebmwebsourcing.easybpel/metadata"));
  if(workOnAttribute != null) {
    final String attributeName = Util.getLocalPartWithoutPrefix(workOnAttribute.getValue());
    final String prefix = Util.getPrefix(workOnAttribute.getValue());
    Namespace nsAttr = null;
    if((prefix != null) && (prefix.trim().length() > 0)) {
      final String ns = this.bpeldefinition.getNamespaceContext().getNamespaceURI(prefix);
      nsAttr = Namespace.getNamespace(prefix, ns) ;
    }
    Attribute rightAttribute = null;
    if(nsAttr != null) {
      rightAttribute = rightSide.getAttribute(attributeName, nsAttr);
    } else {
      rightAttribute = rightSide.getAttribute(attributeName);
    }
    // remove metadata attribute
    rightSide.removeAttribute(workOnAttribute);
    value = rightAttribute.getValue();
  } else {
    value = rightSide.getText();
  }
  return value;
}

代码示例来源:origin: apache/oozie

eAction.removeAttribute("start");
eAction.removeAttribute("end");
eAction.setAttribute("instance-number", Integer.toString(instanceCount));
eAction.setAttribute("action-nominal-time", DateUtils.formatDateOozieTZ(nominalTime));

代码示例来源:origin: com.ebmwebsourcing.easybpel/easybpel.xpath.exp.impl

elmt.removeAttribute(workOnAttribute);

相关文章

微信公众号

最新文章

更多