BUG-2510: Remove all registrations when a routed rpc is closed
[controller.git] / opendaylight / netconf / netconf-util / src / main / java / org / opendaylight / controller / netconf / util / xml / XMLNetconfUtil.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.util.xml;
10
11 import javax.xml.xpath.XPath;
12 import javax.xml.xpath.XPathExpression;
13 import javax.xml.xpath.XPathExpressionException;
14 import javax.xml.xpath.XPathFactory;
15 import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
16
17 public final class XMLNetconfUtil {
18
19     private XMLNetconfUtil() {}
20
21     public static XPathExpression compileXPath(String xPath) {
22         final XPathFactory xPathfactory = XPathFactory.newInstance();
23         final XPath xpath = xPathfactory.newXPath();
24         xpath.setNamespaceContext(new HardcodedNamespaceResolver("netconf",
25                 XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
26         try {
27             return xpath.compile(xPath);
28         } catch (final XPathExpressionException e) {
29             throw new IllegalStateException("Error while compiling xpath expression " + xPath, e);
30         }
31     }
32
33 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.