+
+ public static boolean isHelloMessage(final NetconfMessage msg) {
+ Document document = msg.getDocument();
+ return isHelloMessage(document);
+ }
+
+ private static boolean isHelloMessage(final Document document) {
+ XmlElement element = XmlElement.fromDomElement(document.getDocumentElement());
+ try {
+ // accept even if hello has no namespace
+ return element.getName().equals(HELLO_TAG) &&
+ (!element.hasNamespace() || element.getNamespace().equals(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
+ } catch (MissingNameSpaceException e) {
+ // Cannot happen, since we check for hasNamespace
+ throw new IllegalStateException(e);
+ }
+ }