Clean up namespace handling
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / streams / listeners / DataTreeCandidateFormatter.java
index 43276712006eb30a1dcec8664f3c676c36c6b199..35ef644b17d8d5b0011ce6661310ca8675ae89fb 100644 (file)
@@ -7,8 +7,12 @@
  */
 package org.opendaylight.restconf.nb.rfc8040.streams.listeners;
 
+import static org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationFormatter.DATA_CHANGED_NOTIFICATION_ELEMENT;
+import static org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationFormatter.DATA_CHANGE_EVENT_ELEMENT;
+import static org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationFormatter.NOTIFICATION_ELEMENT;
+import static org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationFormatter.NOTIFICATION_NAMESPACE;
+import static org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationFormatter.SAL_REMOTE_NAMESPACE;
 import static org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationFormatter.XML_OUTPUT_FACTORY;
-import static org.opendaylight.restconf.nb.rfc8040.streams.listeners.XMLNotificationFormatter.DATA_CHANGE_EVENT_ELEMENT;
 
 import java.io.IOException;
 import java.time.Instant;
@@ -43,14 +47,13 @@ abstract class DataTreeCandidateFormatter extends EventFormatter<Collection<Data
     @Override
     final void fillDocument(final Document doc, final EffectiveModelContext schemaContext,
             final Collection<DataTreeCandidate> input) throws IOException {
-        final Element notificationElement = doc.createElementNS("urn:ietf:params:xml:ns:netconf:notification:1.0",
-                "notification");
+        final Element notificationElement = doc.createElementNS(NOTIFICATION_NAMESPACE, NOTIFICATION_ELEMENT);
         final Element eventTimeElement = doc.createElement("eventTime");
         eventTimeElement.setTextContent(toRFC3339(Instant.now()));
         notificationElement.appendChild(eventTimeElement);
 
         final Element notificationEventElement = doc.createElementNS(
-                "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote", "data-changed-notification");
+            SAL_REMOTE_NAMESPACE, DATA_CHANGED_NOTIFICATION_ELEMENT);
 
         for (DataTreeCandidate candidate : input) {
             final Element dataChangedElement = doc.createElement(DATA_CHANGE_EVENT_ELEMENT);