Re: using DOM functions with embedded html / encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



jonathan wrote:
I understand why it is doing it but to be honest, if it's going in as well-formed xml then, it's a bigger problem having these values to be rendered via a 3rd-party stylesheet. Am I expected for them to convert back these entities? Really at that point, the only change that should take place is an xsl transformation.

I can do a copy-of in the xsl and grab out all the data even if it creates another node by being well-formed xml. to be honest, I care less about the DOM at this point than the pain of having to deal with these encoded sequences at the other end.

To be honest, I think the only thing that makes sense is to make it CDATA rather than leaving it as xml.

You could put in a feature request to the php developers (http://bugs.php.net) to add a flag to "leave data as is", so the responsibility comes back to you to give it proper xml (code up a patch and send that with it if you have the skills and time, they will find that most helpful). Whether that gets accepted or not is up to them..

For now I guess cdata is the way to go.


On Mar 21, 2006, at 4:59 PM, Chris wrote:

jonathan wrote:

I'm interested in creating an xml doc from my php5/mysql 4.1 app. I'm using PHP's DOM functions to create the xml file. Some of the text fields now have well-formed html embedded in them. When I do a $dom->createElement('item_name', $clean_slot), it encodes the values to &lt;b&gt; for <b>. How would I suppress this behavior. It doesn't look like there is any other variable I can pass to createElement or to appendChild.


It has to do that so it's not treated as xml itself.

instead of

<data>
&lt;b&gt;
</data>

you'd end up with:

<data>
<b>
</data>

which means you are completely changing the DOM (whether it's valid xml or not is another thing altogether).

--
Postgresql & php tutorials
http://www.designmagick.com/






--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux