Check Notification name match
[yangtools.git] / data / yang-data-util / src / main / java / org / opendaylight / yangtools / yang / data / util / NormalizedNodeStreamWriterStack.java
index 58e078a5e848840c25345878e3178bb0eec994b0..72547fe4285f769da454aa2bd8dc5ff476bb805b 100644 (file)
@@ -254,7 +254,8 @@ public final class NormalizedNodeStreamWriterStack implements LeafrefResolver {
         LOG.debug("Enter container {}", name);
 
         final ContainerLike schema;
-        if (schemaStack.isEmpty() && root instanceof NotificationDefinition notification) {
+        if (schemaStack.isEmpty() && root instanceof NotificationDefinition notification
+            && name.getNodeType().equals(notification.getQName())) {
             // Special case for stacks initialized at notification. We pretend the first container is contained within
             // itself.
             // FIXME: 8.0.0: factor this special case out to something more reasonable, like being initialized at the