Ciao!
devo rimovere l'andare a capo in un file xml, in particolare
devo sostituire il tag <text:line-break/> con un trattino, solo per le righe dentro il tag contenitore <text:index-body>
Questo è il mio codice:
codice HTML:
<text:index-body> <text:p text:style-name="P9">AAAA <text:tab/>5</text:p> <text:p text:style-name="P9"> <text:s/>BBB <text:line-break/>bb1 <text:tab/>6</text:p> <text:p text:style-name="P9"> <text:s/>CCC <text:line-break/>cc1 <text:tab/>6</text:p> <text:p text:style-name="P9"><text:index-body/>
Codice PHP:
$xml=new DOMDocument();$xml->load($_tmp."/content.xml");
$xp= new DOMXPath($xml); $xquery = "/office:document-content/descendant-or-self::text:index-body";$xpic_art= $xp->query($xquery);for ($k=0; $k<$xpic_art->length; $k++) { $s=$xpic_art->item($k); $xpic5=$xp->query(".//text:line-break", $s); if($xpic5->length >0){ $p=$xpic5->item(0); $p->parentNode->replaceChild('', $p); }}
$content=$xml->saveXML();
dove sbaglio?