org.jdom2.Element.getAttributes()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(114)

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

Element.getAttributes介绍

[英]This returns the complete set of attributes for this element, as a List of Attribute objects in no particular order, or an empty list if there are none. The returned list is "live" and changes to it affect the element's actual attributes.
[中]这将返回此元素的完整属性集,作为没有特定顺序的Attribute对象的List或空列表(如果没有)。返回的列表是“活动的”,对它的更改会影响元素的实际属性。

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

public int getAttributeCount() {
  return currentElement.getAttributes().size();
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

public String getAttribute(int index) {
  return currentElement.getAttributes().get(index).getValue();
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

public String getAttributeName(int index) {
  return decodeAttribute(currentElement.getAttributes().get(index).getQualifiedName());
}

代码示例来源:origin: simpligility/android-maven-plugin

@SuppressWarnings( "unchecked" )
private void appendElement( Element source, Element target )
{
  for ( Iterator<Attribute> itr = source.getAttributes().iterator(); itr.hasNext(); )
  {
    Attribute a = itr.next();
    itr.remove();
    Attribute mergedAtt = target.getAttribute( a.getName(), a.getNamespace() );
    if ( mergedAtt == null )
    {
      target.setAttribute( a );
    }
  }
  for ( Iterator<Element> itr = source.getChildren().iterator(); itr.hasNext(); )
  {
    Content n = itr.next();
    itr.remove();
    target.addContent( n );
  }
}

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

@Override
public final Iterator<?> getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException {
  if (isElement(contextNode) && ((Element)contextNode).hasAttributes()) {
    return ((Element)contextNode).getAttributes().iterator();
  }
  return JaxenConstants.EMPTY_ITERATOR;
}

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

for (Attribute att : getAttributes()) {
  Namespace ns = att.getNamespace();
  if (!namespaces.containsKey(ns.getPrefix())) {

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

for (Attribute a : getAttributes()) {
  final String reason = 
      Verifier.checkNamespaceCollision(namespace, a);

代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata

/**
 * @return list {@link Attribute}
 */
public List getAttributes()
{
  return element.getAttributes();
}

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

reason = checkNamespaceCollision(namespace, element.getAttributes());
if (reason != null) {
  return reason;

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

for (Attribute att : element.getAttributes()) {
  final org.w3c.dom.Attr a = printAttribute(fstack, basedoc, att);
  if (a != null) {

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

for (final Attribute a : element.getAttributes()) {
  final Namespace ns = a.getNamespace();
  if (ns == Namespace.NO_NAMESPACE) {

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

for (final Attribute attribute : element.getAttributes()) {
    printAttribute(out, fstack, attribute);
for (final Attribute attribute : element.getAttributes()) {
  printAttribute(out, fstack, attribute);

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

for (Attribute a : element.getAttributes()) {
  if (!a.isSpecified() && fstack.isSpecifiedAttributesOnly()) {
    continue;

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

element.getAttributes().iterator() :
      null;
if (ns == Namespace.NO_NAMESPACE) {

代码示例来源:origin: x-stream/xstream

@Override
public String getAttributeName(final int index) {
  return decodeAttribute(currentElement.getAttributes().get(index).getQualifiedName());
}

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

public Attribute text2attribute(String text) {
    String xtext = "<x " + text + " />";
    return text2element(xtext).getAttributes().get(0).detach();
  }
}

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

public static MCRChangeData setText(Element element, String text) {
  Element clone = element.clone();
  for (Iterator<Attribute> attributes = clone.getAttributes().iterator(); attributes.hasNext();) {
    attributes.next();
    attributes.remove();
  }
  MCRChangeData data = new MCRChangeData("set-text", clone, 0, element);
  element.setText(text);
  return data;
}

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

for (final Attribute attribute : element.getAttributes()) {
  printAttribute(out, fstack, attribute);

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

private static boolean areElementsEqual(Element e1, Element e2) {
 if (e1 == null && e2 == null) return true;
 //noinspection SimplifiableIfStatement
 if (e1 == null || e2 == null) return false;
 return StringUtil.equal(e1.getName(), e2.getName())
   && attListsEqual(e1.getAttributes(), e2.getAttributes())
   && contentListsEqual(e1.getContent(CONTENT_FILTER), e2.getContent(CONTENT_FILTER));
}

代码示例来源: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());
    }
  }
}

相关文章

微信公众号

最新文章

更多