0
<soap-env:envelope xmlns:soap-enc="" xmlns:soap-env="">
    <soap-env:header>
    </soap-env:header>
    <soap-env:body>
        <ns1:createuserresponse>
            <username>weqew_825</username>
            <password>uwnoqedcjs</password>
            <result>
                <succeeded>true</succeeded>
                <errorcode>0</errorcode>
                <errortext></errortext>
            </result>
        </ns1:createuserresponse>
    </soap-env:body>
</soap-env:envelope>

I want to remove xmlns:soap-enc="" xmlns:soap-env="" from above string

Matt
  • 14,906
  • 27
  • 99
  • 149
Anand
  • 21
  • 7

1 Answers1

0

you can use preg_replace

$string = preg_replace('/xmlns:.*\"/','',$string);

BUT it would be better to avoid that since again parsing that xml with SimpleXML will generate a lot of warnings (which could be surpressed with @).

a more solid solution

hope it helped

Community
  • 1
  • 1
Gntem
  • 6,949
  • 2
  • 35
  • 48
  • simplexml_load_string is not converting above string to array that's why i want to remove that attributes – Anand Jul 17 '12 at 11:36