Regex to convert html-image to XML to avoid preloading

diablo

New Member
I am currently pulling an XML feed into a webapp through ajax. Obviously i like using jquery to parse it, like so:\[code\]$(source).find("item"); \[/code\]The problem with this is that everything is converted into nodes, including -tags. Considering this is some sort of RSS feed, and the feed contains complete articles (including image galleries), there are many img-tags. To prevent this, i would like to try and convert the img-tags to something like this:before: \[code\]<img src="http://stackoverflow.com/questions/11134688/path_to_img.jpg" width="450" height="199" alt="alt description" title="image title" class="image_classes" />\[/code\]after:\[code\]<image><src>path_to_img.jpg</src><alt>alt description</alt><title>image title</title><class>image_classes</class></image>\[/code\]If anyone has better suggestions than using regexes, those are of course welcome too. But because it all has to be treated like text, I fear there are few, considering images start preloading when they are added to the DOM.
 
Back
Top