My XML looks like this.
<?xml version="1.0" encoding="utf-8"?>
<ns0:Respuesta xmlns:ns0="http://ift.tt/1mezRKb">
<ns0:Error>
<ns0:Codigo>30</ns0:Codigo>
<ns0:Descripcion>Numero no encontrado en la lista</ns0:Descripcion>
<ns0:Sistema>adaptadorCFMS</ns0:Sistema>
<ns0:Tipo>Adaptador</ns0:Tipo>
<ns0:TimeStamp>2014-06-26T14:40:42</ns0:TimeStamp>
<ns0:IdHost>medusa10</ns0:IdHost>
</ns0:Error>
</ns0:Respuesta>
I need to remove the 'ns0:' part of elements. It doesnt necessarily need to be 'ns0:', it can be 'ns1:' or 'ns2:, hence all those that look like that starting with 'ns' needs to be removed.
The 'ns0:' is also present as a suffix in the namespace xmlns attribute which needs to be removed too.
so the output xml should look like this.
<?xml version="1.0" encoding="utf-8"?>
<Respuesta xmlns="http://ift.tt/1mezRKb">
<Error>
<Codigo>30</Codigo>
<Descripcion>Numero no encontrado en la lista</Descripcion>
<Sistema>adaptadorCFMS</Sistema>
<Tipo>Adaptador</Tipo>
<TimeStamp>2014-06-26T14:40:42</TimeStamp>
<IdHost>medusa10</IdHost>
</Error>
</Respuesta>
Can you please help me with this? I would really appreciate your help.
No comments:
Post a Comment