hmm, i had to do something similar (and it was my mistake, i generated 
some xml without using an api and put the / in the wrong place on the 
closing tag)

i ended up using scanning through the string, using .indexOf on the tail 
to find the next bad part, then doing a lastIndexOf to scan backwards 
for the opening tag and doing some text munging to fix it..

but i think you might be able to get away with some crafty splitting.

if you can split the text on the bad tag, the rejoin with the 
replacement, that might just work.

otherwise you could use myXML.toString().indexOf(badTagString) to get 
where it is, and knowing how long it is, you can then take the head 
(i.e. the result of indexOf) and the tail (indexOf + 
badTagString.length) and insert the correct data in the middle

thats the best i can think of for now..

martin


Marcelo Volmaro wrote:
> Hello list,
> I´m posting this here because flashcoders seems to be dead.
> 
> I have some XML that is bad formated (like <tag>some text <other 2>a 
> text</tag>). I need to replace the < and > in the middle with &lt; and &gt;. 
> The fix should be done in flash (i can´t edit the XML, nor process them at 
> any point).
> Does somebody have a function/class to do this? The tags are limited and 
> known (the XML is HTML).
> 
> Thanks in advance!,
> 

-- 
want to know what i think? probably not

http://relivethefuture.com/choronzon

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to