code: public Document buildFilter(List<PackageFilter> filters) {
      Document doc = documentBuilder.newDocument();
  
      Element workspaceFilterElement = doc.createElement("workspaceFilter");
      workspaceFilterElement.setAttribute("version", "1.0");
      doc.appendChild(workspaceFilterElement);
  
      for (PackageFilter filter : filters) {
        Element filterElement = doc.createElement("filter");
        filterElement.setAttribute("root", filter.getRootPath());
        workspaceFilterElement.appendChild(filterElement);
  
        for (PackageFilterRule rule : filter.getRules()) {
          Element ruleElement = doc.createElement(rule.isInclude() ? "include" : "exclude");
          ruleElement.setAttribute("pattern", rule.getPattern());
          filterElement.appendChild(ruleElement);
        }
      }
  
      return doc;
    }
docs: Build filter XML for package metadata files.
  @param filters Filters
  @return Filter XML