package com.alterdekim.hearthhack.parser;

import com.alterdekim.hearthhack.dbf.CardsDBF;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import java.io.File;

public class DBFParser {

    public static CardsDBF parseCards(String path) throws Exception {
        return parse(path + "/CARD.xml", CardsDBF.class);
    }

    public static <T> T parse(String path, Class<T> cl) throws Exception {
        XmlMapper xmlMapper = new XmlMapper();
        return xmlMapper.readValue(new File(path), cl);
    }
}
