Hi,
I have some data in a flat file called test_file.xml
that reads:
And I want to change it so that it reads :
What is the best way to do this ?
I assume I should open the file and get the contents:
Now should ıs use preg_match()
or would str_replace()
E.g can I have "wild characters" in the str_replace() ?
Maybe I need to use preg_match()
to do this, or preg_replace() ??
Any advice, much appreciated :)
.
I have some data in a flat file called test_file.xml
that reads:
Code:
<?xml version="1.0" encoding="utf-8"?><marketplace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.click2sell.eu/marketplace.xsd"><product>
Code:
<?xml version="1.0" encoding="utf-8"?><marketplace><product>
I assume I should open the file and get the contents:
Code:
$file_in = 'test_file.xml'; $source = file_get_contents( $file_in );
or would str_replace()
E.g can I have "wild characters" in the str_replace() ?
Code:
$source= str_replace('<marketplace xmlns*' , '<marketplace>', $source); // Write it to out file file_put_contents( $file_out, $source );
to do this, or preg_replace() ??
Any advice, much appreciated :)
.
Comment