CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    36

    Cool PHP XML CDATA Problem

    Hi,

    I have a weird problem with CDATA in my PHP code...

    The code goes like this... I query all records into a temporary variable and loop through all of them to create my own xml string.

    then save the string into a file (example: file1.xml)

    The problem is when I try to examine my xml file "file1.xml" I see one of my CDATA tag... is changed from <![CDATA[]] into <!YCDATA[]]..... or <![CDATA[]] into <![CDATAY]].....

    This weird character Y keeps on appearing and it jack up my XML file... anybody have a solution to this... or have encountered the same problem?

    Please help....

    Thanks

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: PHP XML CDATA Problem

    Never seen that before. But, if you notice, it isn't changing both [ brackets. That would rule out any character encoding problems. To me, it seems that the only thing that could be doing this is how you are reading the XML file. Are you sure that there isn't some accidental string replacing?

    Could you post your code so that we might be able to test it out as well?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    36

    Cool Re: PHP XML CDATA Problem

    Hi,

    Thanks for the reply,

    The problem has not occur for sometimes now.... the strange thing is I never make any changes to the code....

    Anyway if the problem comes out again.... I'll try to contact you... I'm not sure if I can give you an exact copy of the script as our company is very strict with that....

    Anyway....

    Thanks much....

  4. #4
    Join Date
    May 2006
    Posts
    306

    Re: PHP XML CDATA Problem

    Try typing more of the CDATA segments, just empty, if it is messing with the XML, it should change all the CDATA blocks with that Y character.

    I don't know whether or not it will give you an error because the extra block are there, or they are empty, but that's what I would do.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured