PHP DOMDocument getElementsByTagName returns 元素不完整?

PHP DOMDocument getElementsByTagName returns incomplete elements?

我正在使用 PHP 5.3。我有以下代码:

view1.html

<!DOCTYPE html>
<html>
<head>
</head>
<body>
      <form method="post">
         <span>Hello this is some text</span>
         <input type="text" name="input1" value="mystuf"/>
         <p>Blah blah this is boring</p>
         <input type="text" name="input2" value="hello"/>
         <img src="image-of-a-kangaroo.png" />
         <input type="text" name="input3" />
         <ul>
            <li>Buy brocolli</li>
            <li>Buy oregano</li>
            <li>Buy milk</li>
         </ul>
         <input type="text" name="input4" />
         <textarea name="input100"></textarea>
         <input type="text" name="input101" />
         <p><strong>Yes, I like pizza!</strong><span>But my porcupine gets sick eating pizza.</span></p>
      </form>
</body>
</html>

index.php

<?php
$xmlDoc = new DOMDocument();
$xmlDoc->loadHTMLFile('view1.html');
$input = $xmlDoc->getElementsByTagName('input');
foreach ($input as $i) {
        echo $i->nodeValue, PHP_EOL;
}

为什么$i->nodeValue总是给出空的或没有结果?

回显 $i->getAttribute('value') 向我展示了我正在寻找的值。