Pressbooks\Modules\Import\Ooxml\Docx::parseContent PHP Метод

parseContent() защищенный Метод

protected parseContent ( DomDocument $xml, string $chapter_title ) : string
$xml DomDocument
$chapter_title string
Результат string
    protected function parseContent(\DomDocument $xml, $chapter_title)
    {
        $element = $xml->documentElement;
        $node_list = $element->childNodes;
        $chapter_node = '';
        $index = 0;
        // loop through child siblings
        for ($i = 0; $i < $node_list->length; $i++) {
            $chapter_node = $this->findTheNode($node_list->item($i), $chapter_title);
            if ('' != $chapter_node) {
                // assumes h1 is going to be first child of parent 'html'
                $index = $i;
                break;
            }
        }
        if ($chapter_node) {
            $chapter_title = strtolower(preg_replace('/\\s+/', '-', $chapter_node->nodeValue));
        }
        // iterate through
        return $this->getChapter($node_list, $index, $chapter_title);
    }