1

I'm trying to get information out of a JSON and I get an error that my XML is not well formed. It points to

if((jsonResponse[0].error) && (jsonResponse[0].error.type == 101)) { 
----------------------------^

Here's the context:

<?xml version="1.0" encoding="UTF-8" ?>
<!--As DOCTYPE either the strict XHTML declaration or 
    "-//HbbTV//1.1.1//EN" "http://www.hbbtv.org/dtd/HbbTV-1.1.1.dtd"
    shall be used as described in the HbbTV-standard: A.2.6.2.-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--Required XML-namespace as described in the HbbTV-standard: A.2.6.2.-->
<html xmlns="http://www.w3.org/1999/xhtml">
kjhughes
  • 106,133
  • 27
  • 181
  • 240
AdrianL
  • 335
  • 2
  • 18

2 Answers2

1

Wrap your JavaScript in CDATA section so that && isn't interpretted as markup:

<script>
<![CDATA[
     JaveScript code here
]]>
</script>
kjhughes
  • 106,133
  • 27
  • 181
  • 240
0

Much better solution is move out your script code into separated file and use src attribute to define path, you won't need work with cdata anymore.

lkrocek
  • 50
  • 4