aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/xml/XmlElementBuilder.java
blob: 16b4865bb9cc2ee273641db0deeb2514759a705f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package org.zwobble.mammoth.xml;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

class XmlElementBuilder {
    private final String name;
    private final Map<String, String> attributes;
    private final List<XmlNode> children;

    XmlElementBuilder(String name, Map<String, String> attributes) {
        this.name = name;
        this.attributes = attributes;
        this.children = new ArrayList<>();
    }
    
    XmlElement build() {
        return new XmlElement(name, attributes, children);
    }

    void addChild(XmlNode node) {
        children.add(node);
    }
}