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

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

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

public List operate(Object node) {
 // With 2.1 semantics it  makes more sense to just return a null and let the core 
 // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      if (!(node instanceof Element)) {
        return null;
      }
      return ((Element) node).getAttributes();
/*
      else
        throw new TemplateModelException("_allAttributes can not be applied on " + node.getClass());
*/                
    }
  }

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

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

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

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

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

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

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

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

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

Element e = (Element) node;
if (localName == null) {
  result.addAll(e.getAttributes());
} else {
  Attribute attr = e.getAttribute(localName, Namespace.getNamespace("", namespaceUri));

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

Iterator attributes = current.getAttributes().iterator();

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

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

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

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

代码示例来源:origin: qcadoo/mes

private void parseAndAddColor(final Map<Integer, Map<String, String>> colorsAttributes, final List<Element> listOfRows,
    final int rowNum) {
  Element node = listOfRows.get(rowNum);
  @SuppressWarnings("unchecked")
  List<Attribute> listOfAtributes = node.getAttributes();
  Map<String, String> colorAttributes = Maps.newHashMap();
  for (int attributeNum = 0; attributeNum < listOfAtributes.size(); attributeNum++) {
    colorAttributes.put(listOfAtributes.get(attributeNum).getName().toLowerCase(Locale.ENGLISH),
        listOfAtributes.get(attributeNum).getValue());
  }
  colorsAttributes.put(rowNum, colorAttributes);
}

代码示例来源:origin: qcadoo/mes

private void parseAndAddAddressType(final Map<Integer, Map<String, String>> addressTypesAttributes,
    final List<Element> listOfRows, final int rowNum) {
  Element node = listOfRows.get(rowNum);
  @SuppressWarnings("unchecked")
  List<Attribute> listOfAtributes = node.getAttributes();
  Map<String, String> addressTypeAttributes = Maps.newHashMap();
  for (int attributeNum = 0; attributeNum < listOfAtributes.size(); attributeNum++) {
    addressTypeAttributes.put(listOfAtributes.get(attributeNum).getName().toLowerCase(Locale.ENGLISH), listOfAtributes
        .get(attributeNum).getValue());
  }
  addressTypesAttributes.put(rowNum, addressTypeAttributes);
}

代码示例来源:origin: qcadoo/mes

private void parseAndAddTypeOfPallet(final Map<Integer, Map<String, String>> typeOfPalletsAttributes, final List<Element> listOfRows, final int rowNum) {
  Element node = listOfRows.get(rowNum);
  @SuppressWarnings("unchecked")
  List<Attribute> listOfAtributes = node.getAttributes();
  Map<String, String> typeOfPalletAttributes = Maps.newHashMap();
  for (int attributeNum = 0; attributeNum < listOfAtributes.size(); attributeNum++) {
    typeOfPalletAttributes.put(listOfAtributes.get(attributeNum).getName().toLowerCase(Locale.ENGLISH),
        listOfAtributes.get(attributeNum).getValue());
  }
  typeOfPalletsAttributes.put(rowNum, typeOfPalletAttributes);
}

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

protected void processAttributes(Element el, DefaultMutableTreeNode dmtn) {
    Iterator atts = el.getAttributes().iterator();
    while (atts.hasNext()) {
      Attribute att = (Attribute)atts.next();
      DefaultMutableTreeNode node = 
        new DefaultMutableTreeNode("@" + att.getName());
      node.add(new DefaultMutableTreeNode(att.getValue()));
      dmtn.add(node);
    }
  }
}

代码示例来源:origin: org.openwfe/openwfe-applic

protected java.util.Map extractAttributes (org.jdom.Element elt)
{
  java.util.Map result = new java.util.HashMap();
  java.util.Iterator it = elt.getAttributes().iterator();
  while (it.hasNext())
  {
    org.jdom.Attribute a = (org.jdom.Attribute)it.next();
    result.put(a.getName(), a.getValue());
  }
  return result;
}

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

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

代码示例来源:origin: qcadoo/mes

private void parseAndAddCountry(final Element node) {
  @SuppressWarnings("unchecked")
  List<Attribute> attributes = node.getAttributes();
  Map<String, String> values = Maps.newHashMap();
  for (Attribute attribute : attributes) {
    values.put(attribute.getName().toLowerCase(Locale.ENGLISH), attribute.getValue());
  }
  addCountry(values);
}

代码示例来源:origin: qcadoo/mes

private void parseAndAddFaultType(final Element node) {
  @SuppressWarnings("unchecked")
  List<Attribute> attributes = node.getAttributes();
  Map<String, String> values = new HashMap<String, String>();
  for (Attribute attribute : attributes) {
    values.put(attribute.getName().toLowerCase(Locale.ENGLISH), attribute.getValue());
  }
  addAction(values);
}

代码示例来源:origin: qcadoo/mes

private void parseAndAddReportColumnWidth(final Element node) {
  @SuppressWarnings("unchecked")
  List<Attribute> attributes = node.getAttributes();
  Map<String, String> values = Maps.newHashMap();
  for (Attribute attribute : attributes) {
    values.put(attribute.getName().toLowerCase(Locale.ENGLISH), attribute.getValue());
  }
  addReportColumnWidth(values);
}

代码示例来源:origin: qcadoo/mes

private void parseAndAddFaultType(final Element node) {
  @SuppressWarnings("unchecked")
  List<Attribute> attributes = node.getAttributes();
  Map<String, String> values = Maps.newHashMap();
  for (Attribute attribute : attributes) {
    values.put(attribute.getName().toLowerCase(Locale.ENGLISH), attribute.getValue());
  }
  addFaultType(values);
}

代码示例来源:origin: qcadoo/mes

private void parseAndAddCurrency(final Element node) {
  @SuppressWarnings("unchecked")
  List<Attribute> attributes = node.getAttributes();
  Map<String, String> values = Maps.newHashMap();
  for (Attribute attribute : attributes) {
    values.put(attribute.getName().toLowerCase(Locale.ENGLISH), attribute.getValue());
  }
  addCurrency(values);
}

相关文章

微信公众号

最新文章

更多