removing <?xml version=&ldquo;1.0&rdquo; tag from XML in php

TerryR

New Member
I have a function returning a xml but returns a xml with two \[code\] <?xml version="1.0"?>\[/code\]tagsI cannot fix the call to return it with one call. Im trying to use SimpleXMLElement so when i load this xml into simplexml it gives a error because of the duplicate tags. Anyone know how i can remove the tag before loading to xml I have tried doing \[code\]$new_xml = preg_replace('/<?xml(.*)?>(.*)?<\/?>/', '', $xml);\[/code\]I have also done (which works by the way. Just not sure if its the best way since im not sure if there may at times be more info inside the \[code\] $xml = str_replace('<?xml version="1.0"?>', '', $xml);\[/code\]
 
Back
Top