private Set getNodeSet(List nodeFilters) {
    if (xi.isNeedsToBeExpanded()) {
      XMLUtils.circumventBug2650(XMLUtils.getOwnerDocument(xi.getSubNode()));
    }

    Set inputSet = new LinkedHashSet();
    XMLUtils.getSet(xi.getSubNode(), inputSet, null, !xi.isExcludeComments());
    Set nodeSet = new LinkedHashSet();
    Iterator i = inputSet.iterator();
    while (i.hasNext()) {
      Node currentNode = (Node) i.next();
      Iterator it = nodeFilters.iterator();
      boolean skipNode = false;
      while (it.hasNext() && !skipNode) {
        NodeFilter nf = (NodeFilter) it.next();
        if (nf.isNodeInclude(currentNode) != 1) {
          skipNode = true;
        }
      }
      if (!skipNode) {
        nodeSet.add(currentNode);
      }
    }
    return nodeSet;
  }
 private static Data copyDerefData(Data dereferencedData) {
   if (dereferencedData instanceof ApacheData) {
     // need to make a copy of the Data
     ApacheData ad = (ApacheData) dereferencedData;
     XMLSignatureInput xsi = ad.getXMLSignatureInput();
     if (xsi.isNodeSet()) {
       try {
         final Set s = xsi.getNodeSet();
         return new NodeSetData() {
           public Iterator iterator() {
             return s.iterator();
           }
         };
       } catch (Exception e) {
         // log a warning
         log.log(Level.WARNING, "cannot cache dereferenced data: " + e);
         return null;
       }
     } else if (xsi.isElement()) {
       return new DOMSubTreeData(xsi.getSubNode(), xsi.isExcludeComments());
     } else if (xsi.isOctetStream() || xsi.isByteArray()) {
       try {
         return new OctetStreamData(xsi.getOctetStream(), xsi.getSourceURI(), xsi.getMIMEType());
       } catch (IOException ioe) {
         // log a warning
         log.log(Level.WARNING, "cannot cache dereferenced data: " + ioe);
         return null;
       }
     }
   }
   return dereferencedData;
 }