You are here: Re: xml_parse and entities and quotes « PHP Programming Language « IT news, forums, messages
Re: xml_parse and entities and quotes

Posted by Toby A Inkster on 02/20/07 08:16

A.Martini wrote:

> I have write a new function
>
> function cdataize($content)
> {
> $content = preg_replace('/\&\#([0-9]+);/','<![CDATA[&#\\1;]]>',$content);
> return($content);
> }

Entities can use hexadecimal notation too...

function cdataize($content)
{
$content = preg_replace('/\&\#([0-9]+);/','<![CDATA[&#\\1;]]>',$content);
$content = preg_replace('/\&\#x([0-9A-F]+);/i','<![CDATA[&#\\1;]]>',$content);
return($content);
}

There are also named entities, like "&emdash;", but I don't think RSS
defines any such entities apart from the five standard XML ones.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация