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

The following examples show how to use org.jdom.Attribute#getValue() . 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: JDOMUtils.java    From geowave with Apache License 2.0 6 votes vote down vote up
public static String getAttrStringValIgnoreNamespace(
    final Element resourceEl,
    final String attrName) {
  final List<?> resourceAttr = resourceEl.getAttributes();

  if (resourceAttr != null) {
    for (final Object attrEl : resourceAttr) {
      final Attribute attr = (Attribute) attrEl;
      if (attrName.equalsIgnoreCase(attr.getName())) {
        return attr.getValue();
      }
    }
  }

  return null;
}
 
Example 2
Source File: PersistentFileSetManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void loadState(Element state) {
  final VirtualFileManager vfManager = VirtualFileManager.getInstance();
  for (Object child : state.getChildren(FILE_ELEMENT)) {
    if (child instanceof Element) {
      final Element fileElement = (Element)child;
      final Attribute filePathAttr = fileElement.getAttribute(PATH_ATTR);
      if (filePathAttr != null) {
        final String filePath = filePathAttr.getValue();
        VirtualFile vf = vfManager.findFileByUrl(filePath);
        if (vf != null) {
          myFiles.add(vf);
        }
      }
    }
  }
}
 
Example 3
Source File: JAXBWriter.java    From subsonic with GNU General Public License v3.0 5 votes vote down vote up
private String getRESTProtocolVersion() throws Exception {
    InputStream in = null;
    try {
        in = StringUtil.class.getResourceAsStream("/subsonic-rest-api.xsd");
        Document document = new SAXBuilder().build(in);
        Attribute version = document.getRootElement().getAttribute("version");
        return version.getValue();
    } finally {
        IOUtils.closeQuietly(in);
    }
}
 
Example 4
Source File: XMLTreeModel.java    From beast-mcmc with GNU Lesser General Public License v2.1 5 votes vote down vote up
ElementObject(Element element) {
    this.element = element;
    id = "";
    Attribute idAttribute = element.getAttribute("id");
    if (idAttribute == null) {
        idAttribute = element.getAttribute("idref");
    }
    if (idAttribute != null) {
        id = idAttribute.getValue();
    }
    children = null;
}
 
Example 5
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 6
Source File: ParameterNameHintsSettings.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private String attributeValue(Element element, String attr) {
  Attribute attribute = element.getAttribute(attr);
  if (attribute == null) {
    return null;
  }
  return attribute.getValue();
}
 
Example 7
Source File: RunConfigurationBeforeRunProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void readExternal(Element element) {
  super.readExternal(element);
  Attribute configurationNameAttr = element.getAttribute("run_configuration_name");
  Attribute configurationTypeAttr = element.getAttribute("run_configuration_type");
  myConfigurationName = configurationNameAttr != null ? configurationNameAttr.getValue() : null;
  myConfigurationType = configurationTypeAttr != null ? configurationTypeAttr.getValue() : null;
}
 
Example 8
Source File: ContentThreadConfigDOM.java    From entando-components with GNU Lesser General Public License v3.0 3 votes vote down vote up
/**
 * Se l'elemento contentThreadConfig ha un attributo sitecode, che specifica
 * il codice del sito abilitato all'invio, lo setta all'interno dell'oggetto
 * {@link NewsletterConfig}
 *
 * @param root
 * l'elemento contentThreadConfig
 * @param contentThreadConfig
 * l'oggetto contenitore della configurazione
 */
private void setSitecode(Element root, ContentThreadConfig contentThreadConfig) {
	Attribute sitecodeAttr = root.getAttribute(SITECODE);
	if (null != sitecodeAttr && sitecodeAttr.getValue().trim().length() > 0) {
		String sitecode = sitecodeAttr.getValue();
		contentThreadConfig.setSitecode(sitecode);
	}
}