Having the next XML(Idatzi.xml) :
<?xml version= 1.0 encoding= ISO-8859-1 ?>
<!DOCTYPE markables SYSTEM "markables.dtd">
<markables>
<markable id="markable_1" atrib="yes" span="word_1..word_4"> </markable>
<markable id="markable_2" atrib="no" span="word_6..word_7"> </markable>
<markable id="markable_3" atrib="yes" span="word_10..word_24"> </markable>
</markables>
以及下一个PHP代码:
<?php
$xmlIdatziDok = new DOMDocument();
if($xmlIdatziDok->load("Idatzi.xml") === FALSE){die( Error );}
$xPath_IdatziDok = new DOMXPath($xmlIdatziDok);
foreach ($xPath_IdatziDok->query( //markables/markable ) AS $Idaztekoa)
{
$IdaztekoaID = $Idaztekoa->getAttribute( id );
$IdaztekoaAtrib = $Idaztekoa->getAttribute( atrib );
if($IdaztekoaAtrib != "yes")
{
$Idazteko->Attribute( atrib ) = "yes";
}
}
I would like to know how to correctly write the next line of code in the PHP code:
$Idazteko->Attribute( atrib ) = "yes";
这显然是错误的写法。 我要做的是,将可加标的2号“无”改为“有”。 任何想法?