What I'm trying to do is get the content HTML inside a div class but don't remove the HTML tags inside the DIV but remove the div query example remove class=test1 only.
Example HTML:

```
<div class="xx1">Some Extra Test<div class="test1">Test1<div class="test2"></div>Some Text</div></div>

```

I need the output to be

```
Test1<div class="test2"></div>Some Text

```

The PHP what I'm testing but this PHP code is deleting all HTML tags inside the div and is output only the text

```
 $html = '<div class="test1">Test1<div class="test2"></div>Some Text</div>';

 function DOC_Change_Data( $HTML = '', $Type = '', $Data = '', $Extra_Data = '' ) {
  if($HTML != '' && $Type != '' && $Data != '') {
   $doc                                                                                                              = new DOMDocument("1.0","UTF-8");
   $doc->preserveWhiteSpace                                                                                          = false;
   @$doc->loadHTML('<?xml encoding="utf-8" ?>' . $HTML, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED); // @ if for suppressing warnings
   $xpath = new DOMXPath($doc);

   if(preg_match("#remove_only_tag#is", $Extra_Data)) {
    if($Type == 'query') {
     $nodes                                                                                                            = $xpath->query($Data);
    } else if($Type == 'getElementsByTagName') {
     $nodes                                                                                                            = $doc->getElementsByTagName($Data);
    }

    foreach($nodes as $node) {
     $prent                                                                                                            = $node->parentNode;
     $prent->replaceChild($doc->createTextNode($node->nodeValue), $node);
    }

    $GET_Node_Data                                                                                                    = str_replace("<?xml encoding=\"utf-8\" ?>", "", $doc->saveHTML());

    return $GET_Node_Data;
   }
  }
 }

 echo DOC_Change_Data( $html, 'query', '//div [@class="test1"]', 'remove_only_tag' ) . "\n\n";

```