I have a soap and I need remove all namespaces prefix from text.
In the next sample the prefixes are "s" and "ans", but they can change all time. The soap xml is something as:
xmlStr=` <s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ans="http://www.ans.gov.br/padroes/tiss/schemas">
<s:Body>
<ans:respostaElegibilidadeWS>
<ans:cabecalho>
<ans:identificacaoTransacao>
<ans:tipoTransacao>SITUACAO_ELEGIBILIDADE</ans:tipoTransacao>
</ans:identificacaoTransacao>
</ans:cabecalho>
</ans:respostaElegibilidadeWS>
</s:Body>
</s:Envelope>`
I need:
<Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ans="http://www.ans.gov.br/padroes/tiss/schemas">
<Body>
<respostaElegibilidadeWS>
<cabecalho>
<identificacaoTransacao>
<tipoTransacao>SITUACAO_ELEGIBILIDADE</tipoTransacao>
</identificacaoTransacao>
</cabecalho>
</respostaElegibilidadeWS>
</Body>
</Envelope>
I have tried:
xmlStr = xmlStr.replace(/<(\/?)\w+:(\w+\/?) ?(\w+:\w+.*)?>/g, "$1$3");
But no look