org.dom4j.Attribute.getName()方法的使用及代码示例

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

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

Attribute.getName介绍

[英]Returns the Namespace of this element if one exists otherwise null is returned returned.
[中]如果存在此元素,则返回该元素的Namespace,否则返回null。

代码示例

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

public String getAttributeName(Object obj)
{
  Attribute attr = (Attribute) obj;
  return attr.getName();
}

代码示例来源:origin: igniterealtime/Openfire

String attName = attribute.getName();
if (attName.startsWith("xmlns:")) {
  String prefix = attName.substring(6);

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

protected Attribute attribute(String namespaceURI, String localName) {
  List<Attribute> attributes = attributeList();
  int size = attributes.size();
  for (Attribute attribute : attributes) {
    if (localName.equals(attribute.getName())
        && (((namespaceURI == null || namespaceURI.length() == 0)
        && ((attribute.getNamespaceURI() == null)
        || (attribute.getNamespaceURI().length() == 0)))
        || ((namespaceURI != null) && namespaceURI
        .equals(attribute.getNamespaceURI())))) {
      return attribute;
    }
  }
  return null;
}

代码示例来源: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 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

String attName = attribute.getName();

代码示例来源:origin: pentaho/pentaho-kettle

private void setAttributeField( Attribute attribute, IProgressMonitor monitor ) {
 String attributname = attribute.getName();
 String attributnametxt = cleanString( attribute.getPath() );
 if ( !Utils.isEmpty( attributnametxt ) && !list.contains( attribute.getPath() ) ) {

代码示例来源: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

public Attribute attribute(String name) {
  final Object attributesShadow = this.attributes;
  if (attributesShadow instanceof List) {
    List<Attribute> list = (List<Attribute>) attributesShadow;
    for (Attribute attribute : list) {
      if (name.equals(attribute.getName())) {
        return attribute;
      }
    }
  } else if (attributesShadow != null) {
    Attribute attribute = (Attribute) attributesShadow;
    if (name.equals(attribute.getName())) {
      return attribute;
    }
  }
  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: org.dom4j/dom4j

public String getAttributeLocalName(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return attribute.getName();
    }
  }
  return null;
}

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

public Attribute attribute(String name) {
  for (Attribute attribute : attributeList()) {
    if (name.equals(attribute.getName())) {
      return attribute;
    }
  }
  return null;
}

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

public Attribute attribute(String name) {
  for (Attribute attribute : attributeList()) {
    if (name.equals(attribute.getName())) {
      return attribute;
    }
  }
  return null;
}

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

public String getAttributeLocalName(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return attribute.getName();
    }
  }
  return null;
}

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

public String getAttributeLocalName(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return attribute.getName();
    }
  }
  return null;
}

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

public Attribute attribute(String name) {
  List list = attributeList();
  int size = list.size();
  for (int i = 0; i < size; i++) {
    Attribute attribute = (Attribute) list.get(i);
    if (name.equals(attribute.getName())) {
      return attribute;
    }
  }
  return null;
}

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

public String getAttributeLocalName(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return attribute.getName();
    }
  }
  return null;
}

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

public String getAttributeLocalName(int index) {
  if (element != null) {
    Attribute attribute = element.attribute(index);
    if (attribute != null) {
      return attribute.getName();
    }
  }
  return null;
}

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

public Attribute attribute(String name) {
  List list = attributeList();
  int size = list.size();
  for (int i = 0; i < size; i++) {
    Attribute attribute = (Attribute) list.get(i);
    if (name.equals(attribute.getName())) {
      return attribute;
    }
  }
  return null;
}

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

相关文章