/** * Generates triggers and QLDs based on decision criteria of the plan. * * @param plan */ public void generateQLD(Plan plan) { doc = DocumentHelper.createDocument(); root = doc.addElement("schema"); root.clearContent(); root.add(SCHEMATRON_NS); Element pattern = root.addElement(new QName("pattern", SCHEMATRON_NS)); String ident = (null == plan.getPlanProperties().getRepositoryIdentifier() ? "" : "(" + plan.getPlanProperties().getRepositoryIdentifier() + ")"); pattern .addElement("title") .setText("QLDs based on plan " + plan.getPlanProperties().getName() + ident); List<Leaf> leaves = plan.getTree().getRoot().getAllLeaves(); List<ValidationError> errors = null; for (Leaf leaf : leaves) { if (leaf.isCompletelySpecified(errors) && leaf.isCompletelyTransformed(errors) && leaf.isMapped()) { if (EvaluationScope.OBJECT == leaf.getMeasure().getAttribute().getCategory().getScope()) { // generate QLD for Preservation Action Plan addQLD(pattern, leaf); } } } }
// 清空document public int clearxml() { // if(document!=null) // if (root.isTextOnly()) { // root.remove(root); // } // document.clearContent(); root.clearContent(); // document.remove(root); return 1; }