0

I am trying to parse the following payload with jQuery's parseXML

<List>
   <Item>
     <Text>
       <?xml version="1.0" encoding="utf-16"?><HTML><BODY><p style="font-size:12px;font-family:Arial;color:#000000;font-weight:Normal;font-style:Normal;"><span>Testing XML formatting</span></p></BODY></HTML>
     </Text>
    </Item>
 </List>

I get the error "Invalid XML". Any ideas as to how this can be resolved? Should I just do an encodeURIComponent for the Text ?

mithrandir
  • 1,323
  • 4
  • 18
  • 39

1 Answers1

1

You can wrap your html(?) in cdata

<List>
   <Item>
     <Text><![CDATA[
       <?xml version="1.0" encoding="utf-16"?><HTML><BODY><p style="font-size:12px;font-family:Arial;color:#000000;font-weight:Normal;font-style:Normal;"><span>Testing XML formatting</span></p></BODY></HTML>]]>
     </Text>
    </Item>
 </List>

http://jsfiddle.net/mowglisanu/BmucX/

Musa
  • 96,336
  • 17
  • 118
  • 137