org.dom4j.Element.attributeIterator()方法的使用及代码示例

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

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

Element.attributeIterator介绍

[英]DOCUMENT ME!
[中]记录我!

代码示例

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

public Iterator getAttributeAxisIterator(Object contextNode)
{
  if ( ! ( contextNode instanceof Element ) )
  {
    return JaxenConstants.EMPTY_ITERATOR;
  }
  Element elem = (Element) contextNode;
  return elem.attributeIterator();
}

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

@Override
  protected void match(Node node) {
    // System.out.println(node.toString());
    if (node instanceof Element) {
      Element element = (Element) node;
      System.out.println("Element: " + element.getQualifiedName());
      System.out.println("\tText: " + element.getText());
      System.out.println("\tAttributes:");
      for (Iterator<?> i = element.attributeIterator(); i.hasNext();) {
        Attribute attribute = (Attribute) i.next();
        System.out.println("\t\t" + attribute.getName() + "=" + attribute.getValue());
      }
    } else if (node instanceof Attribute) {
      Attribute attribute = (Attribute) node;
      System.out.println("Attribute: " + attribute.getName() + "=" + attribute.getValue());
    }
  }
};

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

public String getAttributeValueFromRawName(String rawName) {
  if (element != null) {
    for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = iter.next();
      if (rawName.equals(attribute.getQualifiedName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

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

public String getAttributeValueFromName(String namespaceURI,
    String localName) {
  if (element != null) {
    for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = iter.next();
      if (namespaceURI.equals(attribute.getNamespaceURI())
          && localName.equals(attribute.getName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

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

protected Attributes createAttributes(Element element,
    Attributes namespaceAttributes) throws SAXException {
  attributes.clear();
  if (namespaceAttributes != null) {
    attributes.setAttributes(namespaceAttributes);
  }
  for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) {
    Attribute attribute = iter.next();
    attributes.addAttribute(attribute.getNamespaceURI(), attribute
        .getName(), attribute.getQualifiedName(), "CDATA",
        attribute.getValue());
  }
  return attributes;
}

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

/**
 * Constructs a STAX {@link StartElement}event from a DOM4J {@link
 * Element}.
 * 
 * @param elem
 *            The {@link Element}from which to construct the event.
 * 
 * @return The newly constructed {@link StartElement}event.
 */
public StartElement createStartElement(Element elem) {
  // create name
  QName tagName = createQName(elem.getQName());
  // create attribute & namespace iterators
  Iterator<javax.xml.stream.events.Attribute> attrIter = new AttributeIterator(elem.attributeIterator());
  Iterator<javax.xml.stream.events.Namespace> nsIter = new NamespaceIterator(elem.declaredNamespaces()
      .iterator());
  // create start event
  return factory.createStartElement(tagName, attrIter, nsIter);
}

代码示例来源:origin: me.wuwenbin/template-tools-util

/**
 * @param e
 * @方法功能描述:得到指定节点的属性的迭代器
 * @方法名:getAttrIterator
 * @返回类型:Iterator<Attribute>
 * @时间:2011-4-14下午01:42:38
 */
@SuppressWarnings("unchecked")
public Iterator<Attribute> getAttrIterator(Element e) {
  if (e == null)
    return null;
  return (Iterator<Attribute>) e.attributeIterator();
}

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

public String getAttributeValueFromRawName(String rawName) {
  if (element != null) {
    for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = iter.next();
      if (rawName.equals(attribute.getQualifiedName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

代码示例来源:origin: com.gitee.rslai.base.tool/servertest

private Map<String, Object> getAttribute(Element element) {
  Map attributes = new HashMap();
  Iterator iterator = element.attributeIterator();
  while (iterator.hasNext()) {
    Attribute attribute = (Attribute) iterator.next();
    String attributeName = attribute.getName();
    String attributeValue = attribute.getValue();
    attributes.put(attributeName, attributeValue);
  }
  return attributes;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j

public String getAttributeValueFromRawName(String rawName) {
  if (element != null) {
    for (Iterator iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      if (rawName.equals(attribute.getQualifiedName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

代码示例来源:origin: org.dom4j/org.motechproject.org.dom4j

public String getAttributeValueFromRawName(String rawName) {
  if (element != null) {
    for (Iterator iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      if (rawName.equals(attribute.getQualifiedName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

代码示例来源:origin: org.dom4j/com.springsource.org.dom4j

public String getAttributeValueFromRawName(String rawName) {
  if (element != null) {
    for (Iterator iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      if (rawName.equals(attribute.getQualifiedName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

代码示例来源:origin: maven/dom4j

public String getAttributeValueFromRawName(String rawName) {
  if (element != null) {
    for (Iterator iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      if (rawName.equals(attribute.getQualifiedName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

public String getAttributeValueFromRawName(String rawName) {
  if (element != null) {
    for (Iterator iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      if (rawName.equals(attribute.getQualifiedName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

代码示例来源:origin: com.gitee.rslai.base.tool/servertest

private String getId(Element row) {
    for (Iterator it = row.attributeIterator(); it.hasNext(); ) {
      Attribute attribute = (Attribute) it.next();
      if ("id".equals(attribute.getName())) {
        return attribute.getValue();
      }
    }

    return null;
  }
}

代码示例来源:origin: org.jenkins-ci.dom4j/dom4j

public String getAttributeValueFromRawName(String rawName) {
  if (element != null) {
    for (Iterator iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      if (rawName.equals(attribute.getQualifiedName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

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

public String getAttributeValueFromName(String namespaceURI,
    String localName) {
  if (element != null) {
    for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = iter.next();
      if (namespaceURI.equals(attribute.getNamespaceURI())
          && localName.equals(attribute.getName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

代码示例来源:origin: com.gitee.rslai.base.tool/servertest

public static List<KeyValueStore> getAttribute(Element element) {
  List attributes = new ArrayList();
  Iterator iterator = element.attributeIterator();
  while (iterator.hasNext()) {
    Attribute attribute = (Attribute) iterator.next();
    String attributeName = attribute.getName();
    String attributeValue = attribute.getValue();
    attributes.add(new KeyValueStore(attributeName, attributeValue));
  }
  return attributes;
}

代码示例来源:origin: com.gitee.rslai.base.tool/servertest

private List<KeyValueStore> getAttribute(Element element) {
  List attributes = new ArrayList();
  Iterator iterator = element.attributeIterator();
  while (iterator.hasNext()) {
    Attribute attribute = (Attribute) iterator.next();
    String attributeName = attribute.getName();
    String attributeValue = attribute.getValue();
    attributes.add(new KeyValueStore(attributeName, attributeValue));
  }
  return attributes;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j

public String getAttributeValueFromName(String namespaceURI,
    String localName) {
  if (element != null) {
    for (Iterator iter = element.attributeIterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      if (namespaceURI.equals(attribute.getNamespaceURI())
          && localName.equals(attribute.getName())) {
        return attribute.getValue();
      }
    }
  }
  return null;
}

相关文章

Element类方法