public static Rules parseRules(String fileName) throws ParserConfigurationException, SAXException, IOException, ParseRule.ParseException {
        File fileXML = new File(fileName);
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document document = builder.parse(fileXML);

        Element root = document.getDocumentElement();
        root.normalize();

        Rules rules = new Rules();
        if (root.getNodeName().equals("rules")) {
            NodeList nodeRules = root.getElementsByTagName("rule");
            int totalRules = nodeRules.getLength();
            for (int i = 0; i < totalRules; i++) {
                Element nodeRule = (Element) nodeRules.item(i);
                if (nodeRule.hasAttribute(StringValue.Tags.string) && nodeRule.hasAttribute(StringValue.ID.string)) {
                    String[] tags = nodeRule.getAttribute(StringValue.Tags.string).split("/");
                    NodeList nodePremises = nodeRule.getElementsByTagName("premise");
                    String ID = nodeRule.getAttribute(StringValue.ID.string);

                    Premises premises = new Premises(ID);
                    for (int j = 0; j < nodePremises.getLength(); j++) {
                        Element nodePremise = (Element) nodePremises.item(j);
                        //System.out.println(" j : " + j + " , " + nodePremise.getAttribute(StringValue.Grammar.string));
                        boolean isExistOutput = nodePremise.hasAttribute(StringValue.Output.string);
                        boolean isExistGrammar = nodePremise.hasAttribute(StringValue.Grammar.string);
                        String grammar = isExistGrammar ? nodePremise.getAttribute(StringValue.Grammar.string) : "--";
                        String output = isExistOutput ? nodePremise.getAttribute(StringValue.Output.string) : "--";
                        premises.addPremise(grammar, output);
                    }
                    rules.addRule(tags, premises);
                } else {
                    throw new ParseRule.ParseException("Tag rule harus memiliki atribut tags");
                }
            }

        } else {
            throw new ParseRule.ParseException("Tidak ada Tag rules pada bagian root document");
        }
        return rules;
    }