For the XML parser to ignore a certain section of your XML document, which syntax is correct?
-
<xml:CDATA[ Text to be ignored ]>
-
<![CDATA[ Text to be ignored ]]>
-
<PCDATA> Text to be ignored </PCDATA>
-
<CDATA> Text to be ignored </CDATA>
To solve this question, the user needs to know about the different ways to indicate that certain sections of an XML document should be ignored by the parser.
Option A is incorrect because the syntax is not correct. The correct syntax for CDATA sections is
Option B is correct. is used to indicate that the enclosed text should be treated as character data and ignored by the parser.
Option C is incorrect because PCDATA is used to indicate that the enclosed text contains only character data and should be parsed as such. It does not indicate that the text should be ignored.
Option D is incorrect because the correct syntax for CDATA sections is , not ...
Therefore, the correct answer is:
The Answer is: B.
XML uses CDATA (Character Data) sections to tell the parser to treat enclosed text as literal data rather than markup, so characters like < and & don't need escaping. The correct syntax is . The other options are not valid XML syntax: there's no