What is the proper way to store a file name in XML?

s3cheigo

New Member
I'm using \[code\]XDocument\[/code\] to cache a list of files.\[code\]<file id="20" size="244318208">a file with an &ersand.txt</file>\[/code\]In this example, I used \[code\]XText\[/code\], and let it automatically escape characters in the file name, such as the & with \[code\]&\[/code\]\[code\]<file id="20" size="244318208"><![CDATA[a file with an &ersand.txt]]></file>\[/code\]In this one, I used \[code\]XCData\[/code\] to let me use a literal string rather than an escaped one, so it appears in the XML as it would in my application.I'm wondering if either of them is better than the other under any certain conditions, or if it is just personal taste. Also, if it means anything, the file names may or may not contain illegal characters.
 
Back
Top