func addChild(node *xmlx.Node, name string, attribs Attribs, contents string) *xmlx.Node { child := xmlx.NewNode(xmlx.NT_ELEMENT) child.Name.Local = name child.Value = contents for key, val := range attribs { child.SetAttr(key, fmt.Sprintf("%v", val)) } node.AddChild(child) return child }