diff --git a/ecrire/inc/xml.php b/ecrire/inc/xml.php
index 0b69da2e84a3983c8b3faec5920aefb87d2db8e4..aec3342ac635c968f5df55c3a63841c4c5edc1d3 100644
--- a/ecrire/inc/xml.php
+++ b/ecrire/inc/xml.php
@@ -61,7 +61,6 @@ function spip_xml_parse($texte, $strict=true, $clean=true){
 		if(substr($tag,-1)=='/'){ // self closing tag
 			$tag = substr($tag,0,strlen($tag)-1);
 			$out[$tag][]="";
-			$txt = trim($txt);
 		}
 		else{
 			// tag fermant
@@ -74,15 +73,15 @@ function spip_xml_parse($texte, $strict=true, $clean=true){
 				else return $texte; // un tag qui constitue du texte a reporter dans $before
 			}
 			$content = $chars[0];
-			$txt = trim($chars[2]);
+			$txt = $chars[2]; //trim($chars[2]);
 			if (strpos($content,"<")===FALSE) // eviter une recursion si pas utile
 				$out[$tag][] = $content;
 			else
 				$out[$tag][]=spip_xml_parse($content, $strict, false);
 		}
-		$chars = preg_split("{<([^>]*?)>}s",$txt,2,PREG_SPLIT_DELIM_CAPTURE);
+		$chars = preg_split("{<([^>]*?)>}ms",$txt,2,PREG_SPLIT_DELIM_CAPTURE);
 	}
-	if (count($out)&&(strlen($txt)==0))
+	if (count($out)&&(strlen(trim($txt))==0))
 		return $out;
 	else
 		return $texte;