diff --git a/dom/container.go b/dom/container.go index 174e3c3..08303c4 100644 --- a/dom/container.go +++ b/dom/container.go @@ -142,6 +142,10 @@ func (c *containerImpl) Children() map[string]Node { return c.children } +func (c *containerImpl) Serialize(writer io.Writer, mappingFunc NodeMappingFunc, encFn EncoderFunc) error { + return encFn(writer, mappingFunc(c)) +} + func (c *containerImpl) Lookup(path string) Node { if path == "" { return nil @@ -196,10 +200,6 @@ func (c *containerBuilderImpl) Remove(name string) { delete(c.children, name) } -func (c *containerBuilderImpl) Serialize(writer io.Writer, mappingFunc NodeMappingFunc, encFn EncoderFunc) error { - return encFn(writer, mappingFunc(c)) -} - func (c *containerBuilderImpl) AddContainer(name string) ContainerBuilder { cb := &containerBuilderImpl{} c.add(name, cb) diff --git a/dom/types.go b/dom/types.go index 51de361..60d2ce0 100644 --- a/dom/types.go +++ b/dom/types.go @@ -109,6 +109,7 @@ type NodeList []Node // Container is element that has zero or more child Nodes type Container interface { Node + Serializable // Children returns mapping between child name and its corresponding Node Children() map[string]Node // Child returns single child Node by its name @@ -125,7 +126,6 @@ type Container interface { // ContainerBuilder is mutable extension of Container type ContainerBuilder interface { Container - Serializable // AddValue adds Node value into this Container AddValue(name string, value Node) // AddValueAt adds Leaf value into this Container at given path.