a.php
class modifyDocument extends DOMDocument{
    public  function setNodeValue($TagName,$obj){
        foreach ($obj as $Tag_Name=>$value){
            $Child_Node=$TagName->getElementsByTagName($Tag_Name)->item(0);
            $Child_Node->nodeValue = '';
            $Child_Node->appendChild($this->createCDATASection($value));
        }
    }
}
b.php
$dom=new DOMDocument();
$dom->load($File_path);
$Info_Node=(object)array('HospitalName'=>'','SheetName'=>'','FormSquence'=>'','PrinterDate'=>'');
$DocumentInfo=$dom->getElementsByTagName('Document');
$DocumentInfo_Child=$Document->item(0);
$dom->setNodeValue($DocumentInfo_Child,$Info_Node);
Fatal error: Uncaught Error: Call to undefined method DOMDocument::setNodeValue() 
請問各位大大在使用php 製作xml的時候因為想要新增方法,想請問為甚麼出現找不到我新增的方法,我應該加到php原生的檔案內嗎?