PHP DOM获取整个节点

Good day,

I am trying to achieve the following: With DOM I am trying to fetch all HTML lists within a page

What I would love to have would be:

$Result =   array(
                    '<ul class="MyClass">
                        <li><a href="#">link1</a></li>
                        <li><a href="#">link2</a></li>
                        <li><a href="#">link3</a></li>
                    </ul>',
                    '<ul class="MySubMenu">
                        <li><a href="#">Sublink1</a></li>
                        <li><a href="#">Sublink2</a></li>
                        <li><a href="#">Sublink3</a></li>
                    </ul>'
                    );

I try to do this : But then I can get only its attributes.

And what I would like to have returned are the complete :

<ul class="MyClass">
    <li><a href="#">link1</a></li>
    <li><a href="#">link2</a></li>
    <li><a href="#">link3</a></li>
</ul>

I currently got the following. But I do not get any further than this. Searching the web provides me only sub info and not the entire element.

        ///######## GET ALL IMAGES WITH XPath
        $objects        = $this->dom->getElementsByTagName('ul');

        ///######## RUN THROUGH ALL SET NODES
        foreach($objects as $node){
            exit(print_r($node));

I hope that someone knows how I should approach this issue.
TIAD!

At this point I am starting to think it is not really possible what I want.

I tried to solve it by using explode.

This is my approach to this problem:

    ///########-------------------------------------------------------------
    ///########-------------------------------------------------------------
    ///######## FUNCTION TO GET THE TAG BLOCK
    ///########-------------------------------------------------------------
    ///########-------------------------------------------------------------
    private function GetTagBlock($tpl, $tag, $end = false){
        ///######## IF IT IS THE START TAG
        if($end === true){
            ///######## GET THE LAST ELEMENT
            $Part1  = explode('<'.$tag, $tpl, 2);
            $tpl    = '<'.$tag.$Part1[1].'</'.$tag.'>';
        }
        ///######## GET THE LAST ELEMENT
        else{
            ///######## SETUP AN EMPTY RETURN ARRAY
            $Part1  = explode(strrev('</'.$tag.'>'), strrev($tpl), 2);
            ///######## EXECUTE A MAPPER
            $Part1  = array_map('strrev', $Part1);
            ///######## SET THE TPL
            $tpl    = $Part1[1];
        }
        ///######## IF IT CONCERNS THE START TAG
        if($end === false){
            ///######## CALL ITSELF
            $tpl = $this->GetTagBlock($Part1[1], $tag, true);
        }




        ///########==================================================
        ///######## RETURN THE MODIFIED TEMPLATE
        ///########==================================================
        return($tpl);
        ///########==================================================
    }

try this

    $objects        = $this->dom->getElementsByTagName('ul');
    $ret=array();
    foreach($objects as $node){
    $ret[]=$node->ownerDocument->saveHTML($node)
    }
    var_dump($ret);