Java 类org.jdom2.filter.AbstractFilter 实例源码

项目:xml-patch    文件:DataDrivenTest.java   
private DataDrivenTest(Element e) {
    super(e.getAttributeValue("desc"));

    Filter prologFilter = new AbstractFilter() {
        @Override
        public Object filter(Object o) {
            if (o instanceof Element
                    || o instanceof Comment
                    || o instanceof ProcessingInstruction) {
                return o;
            }
            return null;
        }
    };

    target.addContent(XmlHelper.clone(e.getChild("target").getContent(prologFilter)));
    diff.setRootElement((Element) e.getChild("diff").clone());
    expectedResult.addContent(XmlHelper.clone(e.getChild("result").getContent(prologFilter)));

    String errorName = e.getChild("result").getAttributeValue("error");
    expectedError = errorName == null ? null : ErrorCondition.valueOf(errorName);
}