31 lines
810 B
Java
31 lines
810 B
Java
package simple;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public class SimpleXmlNode
|
|
{
|
|
public String name;
|
|
public Map<String, String> attributes;
|
|
public List<SimpleXmlNode> children;
|
|
public Map<String, List<SimpleXmlNode>> childrenByName;
|
|
|
|
public SimpleXmlNode()
|
|
{
|
|
attributes = new HashMap<String, String>();
|
|
children = new ArrayList<SimpleXmlNode>();
|
|
childrenByName = new HashMap<String, List<SimpleXmlNode>>();
|
|
}
|
|
|
|
public void appendChild(SimpleXmlNode child)
|
|
{
|
|
children.add(child);
|
|
List<SimpleXmlNode> l = childrenByName.get(child.name);
|
|
if (l == null)
|
|
childrenByName.put(child.name, (l = new ArrayList<SimpleXmlNode>()));
|
|
l.add(child);
|
|
}
|
|
}
|