Example usage for org.w3c.dom Element getLocalName

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

Introduction

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

Prototype

public String getLocalName();

Source Link

Document

Returns the local part of the qualified name of this node.

Usage

From source file:it.intecs.pisa.toolbox.security.handler.EOP_SAMLTokenProcessor.java

public void handleToken(Element elem, Crypto crypto, Crypto decCrypto, CallbackHandler cb, WSDocInfo wsDocInfo,
        Vector returnResults, WSSConfig wsc) throws WSSecurityException {
    if (log.isDebugEnabled()) {
        log.debug("Found SAML Assertion element");
    }//from  w  w  w.java 2 s  .  c  o  m
    //the SAML Element is the first child

    Element child = (Element) elem.getFirstChild();
    if (child.getLocalName().indexOf("EncryptedData") != -1) {
        //STE: feature mancante in WSS4J che non si aspetta di trovare un SAML token encrypted che non sia preceduto nell'xml da una relativa EnryptedKey 
        EncryptedDataProcessor proc = new EncryptedDataProcessor();
        proc.handleToken(child, crypto, decCrypto, cb, wsDocInfo, returnResults, wsc);
    }

    SAMLAssertion assertion = handleSAMLToken((Element) elem.getFirstChild());
    this.id = assertion.getId();
    wsDocInfo.setAssertion((Element) elem);
    returnResults.add(0, new WSSecurityEngineResult(WSConstants.ST_UNSIGNED, assertion));
    this.samlTokenElement = elem;

}

From source file:com.joyveb.dbpimpl.cass.prepare.config.xml.CassandraClusterParser.java

@Override
protected void postProcess(BeanDefinitionBuilder builder, Element element) {
    List<Element> subElements = DomUtils.getChildElements(element);

    // parse nested elements
    for (Element subElement : subElements) {
        String name = subElement.getLocalName();

        if ("local-pooling-options".equals(name)) {
            builder.addPropertyValue("localPoolingOptions", parsePoolingOptions(subElement));
        } else if ("remote-pooling-options".equals(name)) {
            builder.addPropertyValue("remotePoolingOptions", parsePoolingOptions(subElement));
        } else if ("socket-options".equals(name)) {
            builder.addPropertyValue("socketOptions", parseSocketOptions(subElement));
        }//from  w w  w . j av  a 2 s.c om
    }

}

From source file:org.smf4j.spring.RegistrarBeanDefinitionParser.java

protected ManagedList<RuntimeBeanReference> parseChildren(ParserContext context, Element element) {
    ManagedList<RuntimeBeanReference> nodes = new ManagedList<RuntimeBeanReference>();
    RegistryNodeTemplateDefinitionParser p = new RegistryNodeTemplateDefinitionParser(false);

    NodeList childNodes = element.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {
        Node childNode = childNodes.item(i);
        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }/* w w w .j  a v  a 2 s .  c o  m*/
        Element child = (Element) childNode;
        String childTagName = child.getLocalName();
        String childBeanId = null;
        if (NODE_TAG.equals(childTagName)) {
            BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(RegistryNodeProxy.class);
            childBeanId = p.parseNode(context, child, bdb);
        } else if (NODE_TEMPLATE_TAG.equals(NODE_TEMPLATE_TAG)) {
            childBeanId = p.createNodeTemplateRef(context, child);
        } else {
            context.getReaderContext().error("Unknown tag", child);
        }

        if (childBeanId != null) {
            nodes.add(new RuntimeBeanReference(childBeanId));
        }
    }

    return nodes;
}

From source file:com.joyveb.dbpimpl.cass.prepare.config.xml.CassandraSessionParser.java

@Override
protected void postProcess(BeanDefinitionBuilder builder, Element element) {
    List<Element> subElements = DomUtils.getChildElements(element);

    // parse nested elements
    for (Element subElement : subElements) {
        String name = subElement.getLocalName();

        if ("keyspace-attributes".equals(name)) {
            builder.addPropertyValue("keyspaceAttributes", parseKeyspaceAttributes(subElement));
            builder.addPropertyValue("tables", parseTablesAttributes(subElement));
        }/*from ww w.j  av a  2s.  c o m*/
    }
}

From source file:com.joyveb.dbpimpl.cass.prepare.config.xml.CassandraSessionParser.java

private ManagedList<Object> parseTablesAttributes(Element element) {

    List<Element> subElements = DomUtils.getChildElements(element);
    ManagedList<Object> tables = new ManagedList<Object>(subElements.size());

    // parse nested elements
    for (Element subElement : subElements) {
        String name = subElement.getLocalName();

        if ("table".equals(name)) {
            tables.add(parseTable(subElement));
        }/*from   w ww. j ava  2 s  .co m*/
    }

    return tables;
}

From source file:com.amalto.workbench.providers.datamodel.util.TypeItemImageCreator.java

@Override
protected Image getImageForElement(Element element) {

    try {/*from  ww  w.  j a v a 2  s . co  m*/
        if ("documentation".equals(element.getLocalName()))//$NON-NLS-1$
            return ImageCache.getCreatedImage(EImage.DOCUMENTATION.getPath());

        if ("appinfo".equals(element.getLocalName())) {//$NON-NLS-1$
            String source = element.getAttribute("source");//$NON-NLS-1$
            if (source != null) {
                if (source.startsWith("X_Label_"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.LABEL.getPath());

                if (source.equals("X_ForeignKey"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.PRIMARYKEY.getPath());

                if (source.equals("X_ForeignKeyInfo"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.KEYINFO.getPath());

                if (source.equals("X_FKIntegrity"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.KEYINFO.getPath());

                if (source.equals("X_FKIntegrity_Override"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.KEYINFO.getPath());

                if (source.equals("X_SourceSystem"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.SOURCESYSTEM.getPath());

                if (source.equals("X_TargetSystem"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.TARGETSYSTEM.getPath());

                if (source.startsWith("X_Description_"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.DOCUMENTATION.getPath());

                if (source.equals("X_Write"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.SECURITYANNOTATION.getPath());

                if (source.equals("X_Hide"))//$NON-NLS-1$
                    return ImageCache.getCreatedImage(EImage.SECURITYANNOTATION.getPath());
            }
        }

        return ImageCache.getCreatedImage(EImage.DOCUMENTATION.getPath());
    } catch (Exception e) {

        log.error(e.getMessage(), e);
    }

    return getImageForUnknown();
}

From source file:loanbroker.CreditAgencyTest.java

public void testCreditHistory() throws Exception {
    drools = new DroolsComponent();
    DroolsEndpoint endpoint = new DroolsEndpoint(drools.getServiceUnit(), new QName("drools"), "endpoint");
    endpoint.setRuleBaseResource(new ClassPathResource("credit-agency.drl"));
    drools.setEndpoints(new DroolsEndpoint[] { endpoint });
    jbi.activateComponent(drools, "servicemix-drools");

    jbi.start();//from   w  ww. j  ava 2  s . c o m

    InOut me = client.createInOutExchange();
    me.setService(new QName("drools"));
    me.setOperation(new QName("urn:logicblaze:soa:creditagency", "getCreditHistoryLength"));
    me.getInMessage().setContent(new StringSource(
            "<getCreditHistoryLengthRequest xmlns='urn:logicblaze:soa:creditagency'><ssn>123456</ssn></getCreditHistoryLengthRequest>"));
    client.sendSync(me);
    Element e = new SourceTransformer().toDOMElement(me.getOutMessage());
    assertEquals("getCreditHistoryLengthResponse", e.getLocalName());
    client.done(me);

    Thread.sleep(50);
}

From source file:de.betterform.xml.xforms.model.submission.Header.java

/**
 * Creates an header implementation./*from   w  w w.  j a v  a 2 s  .  c  o m*/
 *
 * @param element the element.
 * @param model   the context model.
 */
public Header(Element element, Model model) {
    super(element, model);
    name = new ValueChild(
            (Element) DOMUtil.getFirstChildByTagNameNS(this.element, NamespaceConstants.XFORMS_NS, NAME),
            this.model);

    List<Element> headerChilds = DOMUtil.getChildElements(this.element);
    values = new ArrayList();

    for (Element childElement : headerChilds) {
        if (VALUE.equals(childElement.getLocalName())) {
            values.add(new ValueChild(childElement, this.model));
        }

    }
}

From source file:fr.mael.microrss.util.XMLUtil.java

public boolean isAtom(String URL) throws Exception {
    DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
    f.setNamespaceAware(true);/*  w  w w  .jav  a  2s  .c om*/
    DocumentBuilder builder = f.newDocumentBuilder();
    HttpGet get = new HttpGet(URL);
    HttpResponse response = client.execute(get);
    try {
        Document doc = builder.parse(response.getEntity().getContent());
        Element e = doc.getDocumentElement();
        return e.getLocalName().equals("feed") && e.getNamespaceURI().equals("http://www.w3.org/2005/Atom");
    } catch (Exception e) {
        EntityUtils.consume(response.getEntity());
        throw new Exception(e);
    }
}

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.BaseFilterBeanDefinitionParser.java

/** {@inheritDoc} */
protected String resolveId(Element configElement, AbstractBeanDefinition beanDefinition,
        ParserContext parserContext) {/*from  w  w w .j  a  v a  2s  .  c  o  m*/
    return getQualifiedId(configElement, configElement.getLocalName(),
            configElement.getAttributeNS(null, "id"));
}