0
그래서 노드를 제거하려고 시도하는 정확한 경로를 알고 있습니다. 몇 가지 XML 파일을 반복하여 일부 내용을 업데이트합니다. 새로운 콘텐츠를 추가하려면 먼저 이미 존재하는 콘텐츠를 삭제해야합니다. 여기 노드가 simpleXML과 함께 존재하는 경우이를 제거하는 방법
내가 사용하려고하는 코드입니다,하지만 난 구문 분석 오류 메시지가 표시됨 :public function hint_insert() {
foreach($this->hints as $key => $value) {
$filename = $this->get_qid_filename($key);
echo "$key - $filename - $value[0]<br>";
//insert hint within right node using simplexml
$xml = simplexml_load_file($filename);
foreach ($xml->PrintQuestion as $PrintQuestion) {
if (unset($xml->PrintQuestion->content->multichoice->feedback->hint->Passage)) {
$xml->PrintQuestion->content->multichoice->feedback->hint->addChild('Passage', $value[0]);
} else {
$xml->PrintQuestion->content->multichoice->feedback->hint->addChild('Passage', $value[0]);
}
}
}