package org.zwobble.mammoth.xml; import java.util.List; import java.util.Map; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; public class XmlElement implements XmlNode { public XmlElement(String name) { this(name, ImmutableMap.of()); } public XmlElement(String name, Map attributes) { this(name, attributes, ImmutableList.of()); } private final String name; private final Map attributes; private final List children; public XmlElement(String name, Map attributes, List children) { this.name = name; this.attributes = attributes; this.children = children; } public String getName() { return name; } public Map getAttributes() { return attributes; } public List getChildren() { return children; } @Override public T accept(XmlNodeVisitor visitor) { return visitor.visit(this); } public Iterable children() { return children; } @Override public String toString() { return "XmlElement(name=" + name + ", attributes=" + attributes + ", children=" + children + ")"; } }