Search in sources :

Example 76 with NamedNodeMap

use of org.w3c.dom.NamedNodeMap in project camel by apache.

the class XAdESSignatureProperties method replacePrefix.

protected void replacePrefix(Element el, Input input) {
    replacePrefixForNode(el, input);
    NamedNodeMap nnm = el.getAttributes();
    List<Attr> xmlnsToBeRemoved = new ArrayList<Attr>(2);
    int length = nnm.getLength();
    for (int i = 0; i < length; i++) {
        Node attr = nnm.item(i);
        replacePrefixForNode(attr, input);
        if (attr.getNodeType() == Node.ATTRIBUTE_NODE) {
            if ("xmlns".equals(attr.getLocalName()) || "xmlns".equals(attr.getPrefix())) {
                if (XMLSignature.XMLNS.equals(attr.getTextContent()) || findNamespace(input.getMessage()).equals(attr.getTextContent())) {
                    xmlnsToBeRemoved.add((Attr) attr);
                }
            }
        }
    }
    // remove xml namespace declaration for XML signature and XAdES namespace
    for (Attr toBeRemoved : xmlnsToBeRemoved) {
        el.removeAttributeNode(toBeRemoved);
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node) ArrayList(java.util.ArrayList) Attr(org.w3c.dom.Attr)

Example 77 with NamedNodeMap

use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.

the class QueryCacheConfigBuilderHelper method handleEntryListeners.

private void handleEntryListeners(QueryCacheConfig queryCacheConfig, Node childNode) {
    for (Node listenerNode : childElements(childNode)) {
        if ("entry-listener".equals(cleanNodeName(listenerNode))) {
            NamedNodeMap listenerNodeAttributes = listenerNode.getAttributes();
            boolean incValue = getBooleanValue(getTextContent(listenerNodeAttributes.getNamedItem("include-value")));
            boolean local = getBooleanValue(getTextContent(listenerNodeAttributes.getNamedItem("local")));
            String listenerClass = getTextContent(listenerNode);
            queryCacheConfig.addEntryListenerConfig(new EntryListenerConfig(listenerClass, local, incValue));
        }
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig)

Example 78 with NamedNodeMap

use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.

the class QueryCacheConfigBuilderHelper method queryCachePredicateHandler.

private void queryCachePredicateHandler(Node childNode, QueryCacheConfig queryCacheConfig) {
    NamedNodeMap predicateAttributes = childNode.getAttributes();
    String predicateType = getTextContent(predicateAttributes.getNamedItem("type"));
    String textContent = getTextContent(childNode);
    PredicateConfig predicateConfig = new PredicateConfig();
    if ("class-name".equals(predicateType)) {
        predicateConfig.setClassName(textContent);
    } else if ("sql".equals(predicateType)) {
        predicateConfig.setSql(textContent);
    }
    queryCacheConfig.setPredicateConfig(predicateConfig);
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) PredicateConfig(com.hazelcast.config.PredicateConfig)

Example 79 with NamedNodeMap

use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.

the class XmlClientConfigBuilder method handleDiscoveryNodeFilter.

private void handleDiscoveryNodeFilter(Node node, DiscoveryConfig discoveryConfig) {
    NamedNodeMap atts = node.getAttributes();
    Node att = atts.getNamedItem("class");
    if (att != null) {
        discoveryConfig.setNodeFilterClass(getTextContent(att).trim());
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node)

Example 80 with NamedNodeMap

use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.

the class XmlClientConfigBuilder method handleAwsAttributes.

private ClientAwsConfig handleAwsAttributes(Node node) {
    NamedNodeMap atts = node.getAttributes();
    ClientAwsConfig clientAwsConfig = new ClientAwsConfig();
    for (int i = 0; i < atts.getLength(); i++) {
        Node att = atts.item(i);
        String value = getTextContent(att).trim();
        if ("enabled".equalsIgnoreCase(att.getNodeName())) {
            clientAwsConfig.setEnabled(getBooleanValue(value));
        } else if (att.getNodeName().equals("connection-timeout-seconds")) {
            int timeout = getIntegerValue("connection-timeout-seconds", value);
            clientAwsConfig.setConnectionTimeoutSeconds(timeout);
        }
    }
    return clientAwsConfig;
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node)

Aggregations

NamedNodeMap (org.w3c.dom.NamedNodeMap)993 Node (org.w3c.dom.Node)690 NodeList (org.w3c.dom.NodeList)339 Attr (org.w3c.dom.Attr)295 Element (org.w3c.dom.Element)238 Document (org.w3c.dom.Document)154 ArrayList (java.util.ArrayList)92 HashMap (java.util.HashMap)91 DocumentBuilder (javax.xml.parsers.DocumentBuilder)59 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)58 IOException (java.io.IOException)53 SAXException (org.xml.sax.SAXException)41 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)40 List (java.util.List)36 Map (java.util.Map)33 File (java.io.File)27 InputStream (java.io.InputStream)26 CMNamedNodeMap (org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)25 DOMException (org.w3c.dom.DOMException)25 ByteArrayInputStream (java.io.ByteArrayInputStream)19