3 namespace SimpleExcel\Parser;
29 $tables = $html->getElementsByTagName(
'table');
31 foreach ($tables as $table) {
32 $table_child = $table->childNodes;
33 foreach ($table_child as $twrap) {
34 if($twrap->nodeType === XML_ELEMENT_NODE) {
35 if ($twrap->nodeName ===
"thead" || $twrap->nodeName ===
"tbody") {
36 $twrap_child = $twrap->childNodes;
37 foreach ($twrap_child as $tr) {
38 if($tr->nodeType === XML_ELEMENT_NODE && $tr->nodeName ===
"tr") {
40 $tr_child = $tr->childNodes;
41 foreach ($tr_child as $td) {
42 if ($td->nodeType === XML_ELEMENT_NODE && ($td->nodeName ===
"th" || $td->nodeName ===
"td")) {
43 array_push(
$row, $td->nodeValue);
46 array_push($field,
$row);
49 }
else if ($twrap->nodeName ===
"tr") {
51 $twrap_child = $twrap->childNodes;
52 foreach ($twrap_child as $td) {
53 if ($td->nodeType === XML_ELEMENT_NODE && ($td->nodeName ===
"th" || $td->nodeName ===
"td")) {
54 array_push(
$row, $td->nodeValue);
57 array_push($field,
$row);
62 $this->table_arr = $field;
76 $html = new \DOMDocument();
77 $html->loadHTMLFile($file_path);
87 $html = new \DOMDocument();
88 $html->loadHTML($str);