Java Code Examples for org.jdom.Attribute#getName()

The following examples show how to use org.jdom.Attribute#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JDOMCompare.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static String diffAttributes(Element element1, Element element2, String pathPrefix, String mode) {
  for (Object o : element1.getAttributes()) {
    final Attribute attr = (Attribute) o;
    final String name = attr.getName();
    final String value1 = attr.getValue();
    final String value2 = element2.getAttributeValue(name);
    if ( value2 == null ) {
      return MessageFormat.format("Attribute {2} at {0}/@{1}", pathPrefix, name, mode);
    }
    if ( ! value1.equals(value2)){
     return MessageFormat.format("Attribute value mismatch at {0}/@{1}, expected={2}, actual={3}", pathPrefix, name, value1, value2);
    }
  }
  return null;
}
 
Example 2
Source File: RunConfigurationPathMacroFilter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean skipPathMacros(Attribute attribute) {
  final Element parent = attribute.getParent();
  final String attrName = attribute.getName();
  if (parent.getName().equals(EnvironmentVariablesComponent.ENV) &&
      (attrName.equals(EnvironmentVariablesComponent.NAME) || attrName.equals(EnvironmentVariablesComponent.VALUE))) {
    return true;
  }
  return false;
}
 
Example 3
Source File: JDOMStreamReader.java    From cxf with Apache License 2.0 4 votes vote down vote up
public QName getAttributeName(int i) {
    Attribute at = getAttribute(i);

    return new QName(at.getNamespaceURI(), at.getName(), at.getNamespacePrefix());
}