Search code examples
javascriptxmltagsmismatch

<script> causing problem with XML tag name mismatch


In attempting to work with a test page for making some jquery getJSON calls I get errors which show up in the error console of Firefox:

XML tag name mismatch (expected input)
http://localhost:8080/<MyApp>/jquery-1.4.4.js
</body>

XML tag name mismatch (expected input)
http://localhost:8080/<MyApp>/json.js
</body>

The original html has the following:

<html>
  <head>
    <title>Application</title>
      <script type="text/javascript" src="/<MyApp>/jquery-1.4.4.js"></script>
      <script type="text/javascript" src="/<MyApp>/json.js"></script>
  </head>
  <body>
    <h1>Application</h1>
    <p>
    <label id="heartbeatLabel">Gateway Heartbeat:</label>
    <input id="heartbeatStatus" type="text" readonly="true" width="30">
    <input id="jsRunning" type="text" readonly="true" width="30">
    <input id="btnHeartbeat" type="button" value="Test Heartbeat" onclick="javascript:testHeartbeat();">
  </body>

Firebug tells me that the javascript scripts were both found and the Net panel gives a status of 200. Does anyone have any suggestions?


Solution

  • This line is invalid:

    <script type="text/javascript" src="/<MyApp>/jquery-1.4.4.js"></script>
    

    It's not allowed to have < and > in attributes. You have to escape these characters, although that wouldn't solve your problem, because I'm not sure where <MyApp> comes from.