Re: Problems with XML_Transformer

From: Date: Fri, 07 Mar 2003 21:27:18 +0000
Subject: Re: Problems with XML_Transformer
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14145@lists.php.net to get a copy of this message
On Sun, 2002-01-13 at 00:30, Tobias Schlitt wrote: > Sorry, but this does not solve the problem in any way... After > 1 more recursion the & becomes an &. I think I came up with a solution: 1) Change transform() so that it knows if it is inside a recursion. 2) Change _startElement() so that it htmlspecialchars() every attribute value. 3) Change transform() so that it un'htmlspecialchars() its result only when its not inside a recursion. The previous solution transforms every result of xml_parse() into its HTML entities, only when the algorithm is inside recursion. At the end, we simply convert all HTML entities back to their original form. In other words, you'll have to write '&' instead of '&' in your attribute values, but the output will be '&'. I might be missing something here, but I think its worth trying. Check the attached patch to Transformer.php. Regards -- Bruno Pedro PTM.com Get my public key here: http://search.keyserver.net:11371/pks/lookup?op=get&search=0x9FEECDC8

380a381,382 > static $recursive; > 386a389,390 > $recursive++; > 428a433 > $recursive--; 451a457 > 457a464,468 > $recursive--; > if ($recursive == 0) { > $result = strtr($result, array_flip(get_html_translation_table(HTML_SPECIALCHARS))); > } > 500a512,515 > foreach ($attributes as $key => $value) { > $attributes[$key] = htmlspecialchars($value); > } > 504a520 > 513a530 > Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
« previous php.pear.dev (#14145) next »