View Full Version : CDATA question
vbplusme
01-22-2009, 05:13 AM
Hello and Greetings,
I have a MOD that I have been trying to learn how it works and found what I think is a strange call in it so I can wondering if anyone can give me a clue why this was done.
Here is the issue:
<title><![CDATA[mod title test "somequotedtest"]]></title>
The MOD has about a dozen <title> tags in the xml but this is the only one that is wrapped in a CDATA call.
I would really appreciate any info that might explain why this was done.
TIA
Michael
SEOvB
01-22-2009, 05:19 AM
CDATA - (Unparsed) Character Data
The term CDATA is used about text data that should not be parsed by the XML parser.
Characters like "<" and "&" are illegal in XML elements.
"<" will generate an error because the parser interprets it as the start of a new element.
"&" will generate an error because the parser interprets it as the start of an character entity.
Some text, like JavaScript code, contains a lot of "<" or "&" characters. To avoid errors script code can be defined as CDATA.
Everything inside a CDATA section is ignored by the parser.
A CDATA section starts with "<![CDATA[" and ends with "]]>":
vbplusme
01-22-2009, 05:57 AM
Thanks for the reply. So, would the quotes in the Title tag be the reason that they used the CDATA wrapper? It is the only title tag in the MOD that contains any non Alphanumeric characters.
TIA,
Michael
SEOvB
01-22-2009, 07:35 AM
It could be, and more than likely is the reason for the CDATA
vbplusme
01-22-2009, 08:10 AM
Thanks again. I decided to test it to see if that was the issue, so I removed the quotes and the CDATA but when I went to import it, I got a fatal error:
XML Error: Attribute without value on line ...
Something else going on there that I have figured out yet.
Given that I am using this as an opportunity to learn how products/plugins are suppose to work together, I think this is a good thing that its making me debug it. :D
thanks again.
Michael
Marco van Herwaarden
01-22-2009, 08:26 AM
You should not edit the product xml-files. All edits are done in the AdminCP and will be placed in the xml-file when the product is exported.
vbplusme
01-22-2009, 08:32 AM
Thanks for that, I was wondering about that too. In fact I just picked that up from the vBulletin manual and I was thinking that I would get it to work and export it to have a clean version. Thanks very much for the comments.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.