FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Adding a CDATA section
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Adding a CDATA section [message #173673 is a reply to message #173600] Wed, 27 April 2011 21:23 Go to previous messageGo to previous message
JustWondering is currently offline  JustWondering
Messages: 9
Registered: April 2011
Karma:
Junior Member
On Apr 20, 1:51 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
> JustWondering wrote:
>> Thomas 'PointedEars' Lahn wrote:
>>> Adam Harvey wrote:
>>>> JustWondering wrote:
>>>> > What I'm expecting is:
>>>> > <stocklist>
>>>> > <item type="fruit">
>>>> > <description><![CDATA[Apples are <b->yummy</b>]]></description>
>>>> > </item>
>>>> > <item type="vegetable">
>>>> > </item></stocklist>
>
>>>> I'm not really sure why you'd expect that dash in <b->, but at any
>>>> rate, running your code on a current PHP 5.3 build results in what I'd
>>>> expect, which is:
>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <stockList>
>>>> <item type="fruit">
>>>> <description><![CDATA[Apples are <b>yummy</b>]]></description>
>>>> </item>
>>>> <item type="vegetable"/>
>>>> </stockList>
>
>>>> What version of PHP are you running?
>
>>> PHP is not the issue here, but that the OP has not understood what XML is
>>> (and how it is to be used), what a CDATA section is (that its content is
>>> *not* parsed except for `]]>', and so cannot possibly display bold
>>> because of <b>…</b> in it), and that Firebug's innerHTML-based Edit
>>> feature is shaky at best with XML documents served as text/html.
>
>>> Something along
>
>>> header('Content-Type: text/xml; charset=UTF-8');
>
>>> is missing after
>
>>> <?php
>
>>> but that would still not display anything of the markup in bold.  (And
>>> that is good so.)
>
>> Perhaps you should read the post before making up assumptions about
>> the OP.
>
> I really do not have to make assumptions in this case.  It is very obvious
> that you do not know what you are doing.
>
>> Where did I say that I'm expecting to see bold?
>
> In your OP.  Precisely:
>
>>>> What I'm expecting to see is Apples are yummy, with yummy in bold.
>> I am pointing to the generated XML code, not how the generated code is
>> displayed.
>
> Then you should have said so.  XML is not (X)HTML; a `b' element has no
> inherent meaning there.  And when `<b>…</b>' is in a CDATA section, it does
> not constitute an element at all.
>
>> Why would I expect anything in a CDATA section to be displayed?
>
> You should expect the content of a CDATA section to be displayed verbatim
> because that is how it works.  You are not expecting it because evidentially
> you have not understood what a CDATA section is, and how XML works.
>
> Please trim your quotes to the relevant minimum.
>
> PointedEars
> --
> Use any version of Microsoft Frontpage to create your site.
> (This won't prevent people from viewing your source, but no one
> will want to steal it.)
>   -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

So, you've decided that the only legitimate use of CDATA is what your
blinders point you to. If it has not occurred to you yet, there are
possible uses for an XML/XHTML structure other than being viewed
through a web browser. Please trim your ego and insults to the
relevant minimum.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using exec with & - what might I get back?
Next Topic: php sessions and css file?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 04:12:16 GMT 2024

Total time taken to generate the page: 0.07239 seconds