0
比方說,我已經是我加載一個像這樣的XML文件:添加子特定節點
$domtree = new DOMDocument('1.0', 'UTF-8');
$domtree->load('test.xml');
的XML文件中有這樣的結構:
<software>
<info>
<version>6.3</version>
</info>
<some_stuff>
<test1>
<somedata>adsd</somedata>
</test1>
</some_stuff>
</software>
我如何添加解密的新元素?
我想:
$some_stuff = $domtree->getElementsByTagName('software');
$some_stuff = $some_stuff->getElementsByTagName('some_stuff');
$funcgroup = $some_stuff->appendChild($domtree->createElement('test2'));
PHP錯誤:
Call to undefined method DOMNodeList::getElementsByTagName()
然後我得到:'未定義的屬性:的DOMNodeList :: $ documentElement' – Michael