Java Code Examples for org.springframework.util.xml.DomUtils#nodeNameEquals()

The following examples show how to use org.springframework.util.xml.DomUtils#nodeNameEquals() . 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: GetSpringBeansFilter.java    From citrus-admin with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public short accept(Element element) {
    if (DomUtils.nodeNameEquals(element, elementName) &&
            isEqualByNamespace(element, elementNamespace) &&
            isEqualByBeanAttributes(element, attributes)) {
        beanDefinitions.add(element);
    }
    
    return NodeFilter.FILTER_ACCEPT;
}
 
Example 2
Source File: GetSpringBeanFilter.java    From citrus-admin with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public short accept(Element element) {
    if (DomUtils.nodeNameEquals(element, elementName) &&
        isEqualByNamespace(element, elementNamespace) &&
        (isEqualById(element, id) || isEqualByBeanName(element, id))) {
        beanDefinition = element;
    }
    
    return NodeFilter.FILTER_ACCEPT;
}
 
Example 3
Source File: AddSpringBeanFilter.java    From citrus-admin with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public short accept(Element element) {
    if (DomUtils.nodeNameEquals(element, "beans")) {
        element.appendChild(element.getOwnerDocument().createTextNode("\n    ")); //TODO make indentation configurable
        element.appendChild(element.getOwnerDocument().importNode(beanDefinition, true));
    }
    
    return NodeFilter.FILTER_ACCEPT;
}
 
Example 4
Source File: GetSpringImportsFilter.java    From citrus-admin with Apache License 2.0 5 votes vote down vote up
@Override
public short startElement(Element element) {
    if (DomUtils.nodeNameEquals(element, "import")) {
        String resourceLocation = element.getAttribute("resource");

        if (StringUtils.hasText(resourceLocation)) {
            if (resourceLocation.startsWith("classpath:")) {
                resourceLocation = resourceLocation.substring("classpath:".length());
            } else if (resourceLocation.startsWith("file:")) {
                resourceLocation = resourceLocation.substring("file:".length());
            }

            try {
                File importedFile = new FileSystemResource(parentConfigFile.getParentFile().getCanonicalPath() +
                        File.separator + resourceLocation).getFile();

                if (importedFile.exists()) {
                    importedFiles.add(importedFile);
                }
            } catch (IOException e) {
                log.warn("Unable to resolve imported file resource location", e);
            }
        }
    }

    return NodeFilter.FILTER_ACCEPT;
}