2 * Copyright (c) 2018 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.netconf.mdsal.connector.ops;
11 import com.google.common.base.Strings;
12 import org.opendaylight.netconf.api.DocumentedException;
13 import org.opendaylight.netconf.api.xml.XmlElement;
14 import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation;
15 import org.w3c.dom.Element;
16 import org.w3c.dom.NodeList;
18 abstract class AbstractConfigOperation extends AbstractSingletonNetconfOperation {
20 protected AbstractConfigOperation(final String netconfSessionIdForReporting) {
21 super(netconfSessionIdForReporting);
24 protected static NodeList getElementsByTagName(final XmlElement parent, final String key) throws
26 final Element domParent = parent.getDomElement();
27 final NodeList elementsByTagName;
29 if (Strings.isNullOrEmpty(domParent.getPrefix())) {
30 elementsByTagName = domParent.getElementsByTagName(key);
32 elementsByTagName = domParent.getElementsByTagNameNS(parent.getNamespace(), key);
35 return elementsByTagName;