Remove from XML



i need to generate random text from dictionary and save it in xml format. When i open a source code XML file then i have a this symbol 
 at every end of the line and when i posted it to my fulltext engine so i got it in text as r\n\ it is some notation for gap. How can i remove it? I'm using PHP for generating This is the part my code where i generate it.



$xml = new DOMDocument("1.0");

$root = $xml->createElement("add");
$xml->appendChild($root);

$id = $xml->createElement('field', 'd' . $idDoc);
$attribute = $xml->createAttribute('name');
$attribute->value = 'id';
$id->appendChild($attribute);

$content = $xml->createElement("field", $this->sentence);
$attribute = $xml->createAttribute('name');
$attribute->value = 'content';
$content->appendChild($attribute);

$date = $xml->createElement("field", date('Y-m-d\TH:i:s\Z'));
$attribute = $xml->createAttribute('name');
$attribute->value = 'date';
$date->appendChild($attribute);

$doc = $xml->createElement("doc");
$doc->appendChild($id);
$doc->appendChild($content);
$doc->appendChild($date);

$root->appendChild($doc);

$xml->save("$this->exportFolder/d$idDoc.xml") or die("Error");
$this->sentence = '';


Thanks for your help.


No comments:

Post a Comment