Re: Problems with XML_Transformer
| From: | Alan Knowles | Date: | Fri, 07 Mar 2003 11:05:47 +0000 |
| Subject: | Re: Problems with XML_Transformer | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-14132@lists.php.net to get a copy of this message | ||
one of the tricks I found was to return an array - this prevented the reparsing of the return value.. (not sure why it's on by default..)
I also had to hack this in to XML_Transformer_Namespace (as Openoffice has '-' signs in the tags.. -
$element = str_replace('-','_',$element);
This was a quick hack to convert an open-office document into HTML-docbook type pages..
http://devel.akbkhome.com/testTransform.php.txt
Regards
Alan
Bruno Pedro wrote:
On Fri, 2003-03-07 at 08:24, tobias@schlitt.info wrote:-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comThe problem comes up with the "&" and "?" inside the generated URI. The tag returned by the end_linlk() function will be parsed by XML_Transformer again (even if there is no method to call for it) and the XML parser gives an error for "not wellformed token".Make sure you substitute the '&' character for its entity: '&'. Another solution is to turn recursion off, in your transformer.Another point again are XML tags containing PHP code. This code-snippets should be handled as CDATA and not get transformed. I did not find a way to transport the "<?php" and "?>" tags to XHTML.Try typing the PHP code as a CDATA section: <?xml version="1.0"> <php> <![CDATA[ <?phpecho 1+2;?> ]]> </php> Make sure that you return the $cdata inside a CDATA section, and also inside some tag, if you plan to transform this code snippets. function end_php($cdata) { return '<dummy><![CDATA[' . $cdata . ']]></dummy>'; } You only have to this if your transformer is recursive. If not, simply return'ing $cdata is enough. I hope it helps. Regards