static public void removePIs(Node node){
  NodeList children=node.getChildNodes();
  int i=0;
  int len=children.getLength();
  while (i < len) {
    Node child=children.item(i);
    if (child.hasChildNodes()) {
      removePIs(child);
      i++;
    }
 else {
      if (child.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
        node.removeChild(child);
        len--;
      }
 else {
        i++;
      }
    }
  }
}

static public void removePIs ( Node node ) { NodeList children = node . getChildNodes ( ) ; int i = 0 ; int len = children . getLength ( ) ; while ( i < len ) { Node child = children . item ( i ) ; if ( child . hasChildNodes ( ) ) { removePIs ( child ) ; i ++ ; } else { if ( child . getNodeType ( ) == Node . PROCESSING_INSTRUCTION_NODE ) { node . removeChild ( child ) ; len -- ; } else { i ++ ; } } } }
recursively removes all processing instruction nodes from the subtree .
