I have the following code witch is used to display HTML from an XML file. The XML file itself comes from a form POST where a "\" is added in after various HTML tags.
Is there anyway I can modify the script below to hide/remove the "\" when the XML contents are displayed?
<?php
$file="data/_data1.xml";
$xmlDoc = new DOMDocument();
$xmlDoc->load($file);
//shows specific node data
$x=$xmlDoc->getElementsByTagName( "_tag_1" );
$x=$x->item(0)->nodeValue;
//show result
echo $x;
echo "<br />";
?>
I've tried using preg_replace but it still doesn't remove the "\"
<?php
<?php
$file="data/_data1.xml";
$xmlDoc = new DOMDocument();
$xmlDoc->load($file);
//shows specific node data
$x=$xmlDoc->getElementsByTagName( "_tag_1" );
$x=$x->item(0)->nodeValue;
//remove backslash
$xx=trim(preg_replace('/\+/', ' ', $x));
//show result
echo $xx;
echo "<br />";
?>
Anyone got any other ideas how I can hide/remove the "\"?
Thanks.