Click to See Complete Forum and Search --> : PHP XML CDATA Problem


jessej3000
July 9th, 2008, 03:12 AM
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

PeejAvery
July 9th, 2008, 07:32 AM
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?

jessej3000
July 22nd, 2008, 10:59 PM
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....

code?
July 28th, 2008, 02:59 PM
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.