Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Monsieur OUXX on Wed 24/04/2013 12:47:05

Title: What is "CDATA" used for in the .agf game file?
Post by: Monsieur OUXX on Wed 24/04/2013 12:47:05
Quick quesiton. Here is an excerpt of a regular .agf file :

Code (AGS) Select

      <Dialog>
        <ID>0</ID>
        <Name>dMulbray1</Name>
        <ShowTextParser>False</ShowTextParser>
        <Script><![CDATA[// Dialog script file
@S  // Dialog startup entry point
return
...
@8
mulbray: Goodbye.
stop
]]></Script>


What does that stand for:
Code (AGS) Select
<![CDATA[ ... ]]
I'm confused by the single opening bracket and the double closing bracket as well. And the exclamation mark.
Title: Re: What is "CDATA" used for in the .agf game file?
Post by: JJS on Wed 24/04/2013 12:51:32
It tells the xml parser to ignore everything inside the CDATA field, so that it doesn't get interpreted as xml: http://www.w3schools.com/xml/xml_cdata.asp . Exlamation mark and double brackets are just how it is written.
Title: Re: What is "CDATA" used for in the .agf game file?
Post by: Crimson Wizard on Wed 24/04/2013 12:58:56
http://en.wikipedia.org/wiki/CDATA
http://msdn.microsoft.com/en-gb/library/system.xml.xmltextwriter.writecdata.aspx

EDIT: Duh! beaten by JJS.

Quote from: JJS on Wed 24/04/2013 12:51:32
It tells the xml parser to ignore everything inside the CDATA field, so that it doesn't get interpreted as xml
Simply put, this allows to write any special chars there without breaking xml structure.
Title: Re: What is "CDATA" used for in the .agf game file?
Post by: Monsieur OUXX on Wed 24/04/2013 13:09:09
I had no idea CDATA was something universal, I thought it was specific to AGS; that's why I overlooked the Wikipedia article and everything else.
Thanks for the clarification, guys.