Vote count:
0
I have a XML being parsed as string.. the basic structure is something as below
<envelope>
<body>
<entity1>
<tag1>
.
.
</tag 1>
<tag2>
.
.
</tag2>
</entity1>
<entity 2>
<tag1>
.
.
</tag1>
<tag2>
.
.
</tag2>
</entity2>
I need to remove the tags lets say tag2 i.e. the whole .. block. I am doing this using a while loop, something like
while(str.indexOf("<tag2>")>=0)
{
strRepl=str.substring(str.indexOf("<tag2>"),str.indexOf("</tag2>")+7);
str=xmlString.replaceFirst(strRepl,"");
}
This is working but i wanted to understand if there is a better way to implement this using strings? Please suggest.
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire