aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/xml/XmlNodes.java
blob: 9531f178c28d81397bf892b047427afb703dcb57 (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
26
27
28
29
30
31
package org.zwobble.mammoth.xml;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

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

import static org.zwobble.mammoth.util.MammothMaps.map;

public class XmlNodes {
    public static XmlElement element(String name) {
        return element(name, ImmutableList.of());
    }

    public static XmlElement element(String name, Map<String, String> attributes) {
        return element(name, attributes, ImmutableList.of());
    }

    public static XmlElement element(String name, List<XmlNode> children) {
        return element(name, map(), children);
    }

    public static XmlElement element(String name, Map<String, String> attributes, List<XmlNode> children) {
        return new XmlElement(name, attributes, children);
    }

    public static XmlTextNode text(String value) {
        return new XmlTextNode(value);
    }
}