3

嗨,我有一个.drl文件,我想将其转换为 .brl 并将其发送给 guvnor。我使用以下函数,但.xml创建的文件不正确。

public static String viceVersa() {

    String pathDrl ="resources" + "\\" + "rules" + "\\" + "testRule.drl";
    try {
        PackageDescr pkg = new DrlParser().parse(true, FileUtils.readFile(pathDrl));
        byte[] content = FileUtils.stringToByte(new XmlDumper().dump(pkg));
        System.out.println(new String(content));
    } catch (Exception e) {
        e.printStackTrace();
    }

} 

这创建了 xml 文件:

<rule name="Active Basij">
**<rule-attribute name="dialect" value="java"/>**
<lhs>
    <pattern>
        <identifier>
            r
        </identifier>
        <fact>
            RuleFact
        </fact>
        <field-constraint>
            <field-name>honestly</field-name>
            <literal-restriction evaluator="==" value="100"/>
        </field-constraint>
        <field-constraint>
            <field-name>isWear</field-name>
            <literal-restriction evaluator="==" value="80"/>
        </field-constraint>
    </pattern>
</lhs>
***<rhs>
    r.setAnswer("This Person Is Active Basij");
    update( r );
</rhs>***

guvnor 不接受这种格式。请帮我

4

0 回答 0