Page 1 of 1

xml parsing

Posted: Sun Mar 02, 2003 8:45 am
by CodeEye
i have built a basic rss parser to parse my own rss files but i am unable to
pass html code into the discription section i am using the default xml
parser provided by php as my server does not support the dom extention yet have any of you had this problem i have tried using-
<![CDATA[
but it still does not work
i was wandering how anyone else solved the problem and how

thanks

Posted: Sun Mar 02, 2003 12:23 pm
by Stoker
Not sure if I understood what you ment, but, you have to use entity conversion for XML just as you would for HTML, so if you need your data to hold a literal < and > you have to convert them to < and > and such.. there are only a few entities predefined in xml, the rest uses the numeric reference. (I which the PHP-devs would create a xmlspecialchars())

If your mentioning of html is in regards to presentation of data, you should look into XSLT, PHP has XSLT support with the expat and sablotron extension, if compiled in.

I never had a problem with the built in sax parser, if I don't have XML-DOM and need miltidimensional data access i often find it useful to use something like Hans Anderson's code,
http://www.hansanderson.com/php/xml/xmlize.inc.txting, I never used his as is but I often used parts and tweaks of it..

Posted: Mon Mar 03, 2003 5:11 am
by CodeEye
thanks i will go through it