本文介绍了在XML PHP Xpath上寻求帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$Result = $objXML->xpath(''AllRelease/Release/name[@rdate="''.$DATERELEASE.''"]'');
if(empty($Result)){
$AllRelease = $objXML->xpath("//AllRelease");
$releas = $AllRelease[0]->prependChild2("Release");
$dat = $releas->prependChild2("name");
$dat->addAttribute("rdate",$DATERELEASE);
$releas->prependChild("comment",$COMMENT);
$Anime = $releas->prependChild2("Anime");
$Anime->prependChild("popup",$POPUP);
$Anime->prependChild("Title",$VIDEONAME);
$Anime->prependChild("VideoUrl",$dir);
$objXML->asXML("MainRelease.xml");
}else{
$Anime = $objXML->xpath("//Release");
$anime = $Anime[0]->addChild("Anime");
$anime->addChild("popup",$POPUP);
$anime->addChild("Title",$VIDEONAME);
$anime->addChild("VideoUrl",$dir);
$objXML->asXML("MainRelease.xml");
}
我执行了此操作,并且$ Result在任何情况下总是让我为空,因此基本上他不会执行第二条声明xpath不起作用,因为我第一次使用xpath,simplexml,xml不能完全确定,<
i did this and $Result always giving me empty in any condition so basically he won''t do the second statement the xpath not working im not really sure since its first time i working with xpath, simplexml, xml any help would be appreciate
推荐答案
这篇关于在XML PHP Xpath上寻求帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!