docs: private void copyNodes(Document document, Node in, Node out) {
          String parentNamespace = in.getNamespaceURI();
          String parentLocalName = in.getLocalName();
          for (int i = 0; i < in.getChildNodes().getLength(); i++) {
              Node childNode = in.getChildNodes().item(i);
              Node newNode = document.importNode(childNode, false);
              //PK53882 - add check for null on childNode
              if (childNode != null && childNode.getNodeType() == Node.CDATA_SECTION_NODE) {
                  if (parentNamespace != null) {
                      if (parentNamespace.equals(Constants.JSP_NAMESPACE)) {
                          if (parentLocalName.equals(Constants.JSP_DECLARATION_TYPE) == false &&
                              parentLocalName.equals(Constants.JSP_EXPRESSION_TYPE) == false &&
                              parentLocalName.equals(Constants.JSP_SCRIPTLET_TYPE) == false) {                        
                              String jspId = ((Element)in).getAttributeNS(Constants.JSP_NAMESPACE, "id");
                              Element jspTextElement = document.createElementNS(Constants.JSP_NAMESPACE, "jsp:text");
                              jspTextElement.appendChild(newNode);
                              jspTextElement.setAttributeNS(Constants.JSP_NAMESPACE, "jsp:id", jspId);
                              out.appendChild(jspTextElement);    
                          }
                      }
                      else {
                          String jspId = ((Element)in).getAttributeNS(Constants.JSP_NAMESPACE, "id");
                          Element jspTextElement = document.createElementNS(Constants.JSP_NAMESPACE, "jsp:text");
                          jspTextElement.appendChild(newNode);
                          jspTextElement.setAttributeNS(Constants.JSP_NAMESPACE, "jsp:id", jspId);
                          out.appendChild(jspTextElement);    
                      }
                  }
              }
              else {
                  //PK53882 - add check for null on newNode
                  if (newNode != null) {
                      //Defect 216189 Start
                      if (newNode.getNodeType() == Node.ELEMENT_NODE) {
                          NamedNodeMap attrs = newNode.getAttributes();
                          for (int j = 0; j < attrs.getLength(); j++) {
                              Attr attr = (Attr)attrs.item(j);
                              String value = attr.getValue();
                              value = value.replaceAll("&gt;", ">");
                              value = value.replaceAll("&lt;", "<");
                              value = value.replaceAll("&amp;", "&");
                              attr.setValue(value);
                          }
                      }
                      //Defect 216189 End
                      out.appendChild(newNode);
                  }
              }
              //PK53882 - add checking for nulls
              if (childNode != null && newNode != null) {
                  copyNodes(document, childNode, newNode);
              }
          }
      }