Example usage for org.w3c.dom Element getAttributeNS

List of usage examples for org.w3c.dom Element getAttributeNS

Introduction

In this page you can find the example usage for org.w3c.dom Element getAttributeNS.

Prototype

public String getAttributeNS(String namespaceURI, String localName) throws DOMException;

Source Link

Document

Retrieves an attribute value by local name and namespace URI.

Usage

From source file:edu.internet2.middleware.psp.spring.ChangeLogExactAttributeFilterBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(element, parserContext, builder);

    builder.addConstructorArgValue(element.getAttributeNS(null, "name"));
    builder.addConstructorArgValue(element.getAttributeNS(null, "value"));
}

From source file:uk.org.ukfederation.uaattribute.resolver.UserAgentAttributeMapDataConnectorBeanDefinitionParser.java

/**
 * Parses a set of Mapping elements.//from w w w  .j a  v  a 2  s  .c om
 * 
 * @param mappings the mapping elements
 * 
 * @return the parsed forms of the elements
 */
private List<Pair<IPRange, Pair<String, String>>> parseAttributeMappings(List<Element> mappings) {
    ArrayList<Pair<IPRange, Pair<String, String>>> parsedMappings = new ArrayList<Pair<IPRange, Pair<String, String>>>();

    String ipRangeString;
    String attributeId;
    String attributeValue;
    for (Element mapping : mappings) {
        ipRangeString = DatatypeHelper.safeTrimOrNullString(mapping.getAttributeNS(null, CIDR_BLOCK_ATTR_NAME));
        if (ipRangeString == null) {
            log.debug("Ignoring mapping with missing or empty CIDR block");
        }

        attributeId = DatatypeHelper.safeTrimOrNullString(mapping.getAttributeNS(null, ATTRIBUTE_ID_ATTR_NAME));
        if (attributeId == null) {
            log.debug("Ignoring mapping with missing or empty attribute ID");
        }

        attributeValue = DatatypeHelper
                .safeTrimOrNullString(mapping.getAttributeNS(null, ATTRIBUTE_VALUE_ATTR_NAME));
        if (attributeValue == null) {
            log.debug("Ignoring mapping with missing or empty attribute value");
        }

        parsedMappings.add(new Pair<IPRange, Pair<String, String>>(IPRange.parseCIDRBlock(ipRangeString),
                new Pair<String, String>(attributeId, attributeValue)));
    }

    return parsedMappings;
}

From source file:edu.internet2.middleware.psp.spring.PsoReferencesBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(element, builder);

    String name = element.getAttributeNS(null, "name");
    builder.addPropertyValue("name", name);

    if (element.hasAttributeNS(null, "emptyValue")) {
        String emptyValue = element.getAttributeNS(null, "emptyValue");
        builder.addPropertyValue("emptyValue", emptyValue);
    }/*from w ww .  j  a v  a  2  s  .co m*/

    if (element.hasAttributeNS(null, "caseSensitive")) {
        String caseSensitive = element.getAttributeNS(null, "caseSensitive");
        builder.addPropertyValue("caseSensitive", caseSensitive);
    }

    Map<QName, List<Element>> configChildren = XMLHelper.getChildElements(element);

    builder.addPropertyValue("psoReferences", SpringConfigurationUtils.parseInnerCustomElements(
            configChildren.get(PsoReferenceBeanDefinitionParser.TYPE_NAME), parserContext));
}

From source file:edu.internet2.middleware.psp.spring.PspServiceBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element configElement, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(configElement, parserContext, builder);

    String attributeAuthorityId = configElement.getAttributeNS(null, "authority");
    builder.addPropertyReference("attributeAuthority", attributeAuthorityId);
}

From source file:edu.internet2.middleware.psp.spring.SimpleAttributeAuthorityBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(element, parserContext, builder);

    builder.addConstructorArgReference(element.getAttributeNS(null, "resolver"));

    if (element.hasAttributeNS(null, "filter")) {
        builder.addPropertyReference("filteringEngine", element.getAttributeNS(null, "filter"));
    }/*from   w  ww .ja v  a 2s . c o  m*/
}

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.match.basic.AbstractAttributeTargetedRegexMatchFunctorBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element configElement, BeanDefinitionBuilder builder) {
    super.doParse(configElement, builder);

    builder.addPropertyValue("attributeId",
            DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, "attributeID")));
}

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.match.saml.AbstractEntityGroupMatchFunctorBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element configElement, BeanDefinitionBuilder builder) {
    super.doParse(configElement, builder);

    builder.addPropertyValue("entityGroup",
            DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, "groupID")));
}

From source file:ch.SWITCH.aai.idp.x509.X509LoginHandlerBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element config, BeanDefinitionBuilder builder) {
    super.doParse(config, builder);

    builder.addPropertyValue("authenticationServletURL",
            DatatypeHelper.safeTrim(config.getAttributeNS(null, "authenticationServletURL")));
    builder.addPropertyValue("loginPageURL",
            DatatypeHelper.safeTrim(config.getAttributeNS(null, "loginPageURL")));
    builder.addPropertyValue("cookieDomain",
            DatatypeHelper.safeTrim(config.getAttributeNS(null, "cookieDomain")));
}

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.match.saml.AbstractNameIDFormatSupportedMatchFunctorBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element configElement, BeanDefinitionBuilder builder) {
    super.doParse(configElement, builder);

    builder.addPropertyValue("nameIdFormat",
            DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, "nameIdFormat")));
}

From source file:edu.internet2.middleware.psp.spring.PsoAttributeBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(element, builder);

    String name = element.getAttributeNS(null, "name");
    builder.addPropertyValue("name", name);

    String ref = element.getAttributeNS(null, "ref");
    if (ref.equals("")) {
        ref = name;/*from www. j  a va 2  s.c om*/
    }
    builder.addPropertyValue("ref", ref);

    boolean isMultiValued = false;
    if (element.hasAttributeNS(null, "isMultiValued")) {
        isMultiValued = XMLHelper.getAttributeValueAsBoolean(element.getAttributeNodeNS(null, "isMultiValued"));
    }
    builder.addPropertyValue("isMultiValued", isMultiValued);

    boolean replaceValues = false;
    if (element.hasAttributeNS(null, "replaceValues")) {
        replaceValues = XMLHelper.getAttributeValueAsBoolean(element.getAttributeNodeNS(null, "replaceValues"));
    }
    builder.addPropertyValue("replaceValues", replaceValues);

    boolean retainAll = false;
    if (element.hasAttributeNS(null, "retainAll")) {
        retainAll = XMLHelper.getAttributeValueAsBoolean(element.getAttributeNodeNS(null, "retainAll"));
    }
    builder.addPropertyValue("retainAll", retainAll);
}