0

i'm having a strange problem with my xml (i'm parsing it with jQuery):

<?xml version='1.0' encoding='ISO-8859-1' ?>
<root>
    <msg><![CDATA[<b>Email was sent!</b>]]</msg>     
    <cod>ok</cod>
</root>

when parsing - retrieving <cod> works but <msg> doesn't (it returns blank). it works when omitting the <![CDATA[ tag .. this is strange - i checked the syntax and it must be correct :/

any ideas what could be wrong?

thanks

2 Answers 2

4

Your CDATA block is not closed so you have invalid XML - A CDATA section starts with <![CDATA[ and ends with ]]> so it should be:

<?xml version='1.0' encoding='iso-8859-1' ?>
<root>
  <msg><![CDATA[<b>Email was sent!</b>]]></msg>     
    <cod>ok</cod>
</root>
Sign up to request clarification or add additional context in comments.

Comments

3

A CDATA section must be closed with ]]>, you are missing the >.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.