Do not expose DataObjectSerializerRegistry outside of codec
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / impl / BindingToNormalizedStreamWriter.java
index 7b9117fb8d0e96baaad4954953f32286244b9f1f..a3513f74faaf57ba719d57d96820643c4acf79d1 100644 (file)
@@ -139,9 +139,11 @@ final class BindingToNormalizedStreamWriter implements AnydataBindingStreamWrite
     @Override
     public void anyxmlNode(final String name, final Object value) throws IOException {
         final Entry<NodeIdentifier, Object> dom = serializeLeaf(name, value);
-        delegate.startAnyxmlNode(dom.getKey());
-        delegate.domSourceValue((DOMSource) dom.getValue());
-        delegate.endNode();
+        // FIXME: this is not quite right -- we should be handling other object models, too
+        if (delegate.startAnyxmlNode(dom.getKey(), DOMSource.class)) {
+            delegate.domSourceValue((DOMSource) dom.getValue());
+            delegate.endNode();
+        }
     }
 
     @Override