I have some data in a flat file called test_file.xml
that reads:
Expand|Select|Wrap|Line Numbers
- <?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>
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="utf-8"?><marketplace><product>
I assume I should open the file and get the contents:
Expand|Select|Wrap|Line Numbers
- $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() ?
Expand|Select|Wrap|Line Numbers
- $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 :)
.