Jump to content


Check out our Community Blogs

shr

Member Since 06 Apr 2012
Offline Last Active Apr 21 2012 02:04 AM
-----

Topics I've Started

Process And Fix Xml String

14 April 2012 - 06:44 AM

I have an HTML file from which I extract useful info and save it as XML in a string. This XML data within the string contains a few urls enclosed in quotes. urls with special characters can make the whole XML file invalid. How to rectify this?

I've used htmlspecialchars already but it also converts the valid characters such as '<' in '<outline' into '&lt;' which I do not want it to do. I simply want the urls/titles/names etc to be checked whether they are valid; or if they are not, they must be made valid. I've considered passing each url through htmlspecialchars but it slows down process a lot.

A part of my xml string looks as follows:


<outline title="inspiration" text="inspiration">

<outline text="Paul Graham" title="Paul Graham" type="rss" xmlUrl="http://www.aaronsw.com/2002/feeds/pgessays.rss" htmlUrl="http://www.paulgraham.com/index.html"/>

<outline text="Flickr: Shreeda Kumar&#39;s Photostream" title="Flickr: Shreeda Kumar&#39;s Photostream" type="rss" xmlUrl="http://api.flickr.com/services/feeds/photos_public.gne?id=47780284@N06&amp;lang=en-us&amp;format=rss_200" htmlUrl="http://www.flickr.com/photos/shreeda-kumar/"/>

<outline text="Lea Verou | Life at the bleeding edge (of web standards)" title="Lea Verou | Life at the bleeding edge (of web standards)" type="rss" xmlUrl="http://lea.verou.me/feed/" htmlUrl="http://lea.verou.me/"/>

</outline>

To Learn And Make Friends

06 April 2012 - 06:21 PM

Hi all!

I have holidays now and to make good use of the time, I've already started learning PHP. I've wandered through this forum and I must say that it's excellent. I'm glad I found you all. :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download