2017-04-11 80 views
0

我有這個XML文件,當我嘗試解析它時,它給了我錯誤。XML文件分析錯誤

';'字符,十六進制值0x3B,不能包括在名稱

這裏是XML文件中的代碼,會有人請告訴我如何解決它?感謝您的幫助。

<html> 
<head> 
<script type="text/javascript"> 
    window.NREUM || (NREUM = {}); 
    NREUM.info = { 
     "beacon": "bam.xxxxxxxxx.net", 
     "errorBeacon": "bam.xxxxxxxxx.net", 
     "licenseKey": "4xxxxxxxx", 
     "applicationID": "2xxxxxxx", 
     "transactionName": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==", 
     "queueTime": 0, 
     "applicationTime": 1xxxxxx, 
     "agent": "", 
     "atts": "" 
    } 
</script> 
<script type="text/javascript"> 
    window.NREUM || (NREUM = {}), __nr_require = function(e, n, t) { 
     function r(t) { 
      if (!n[t]) { 
       var o = n[t] = { 
        exports: {} 
       }; 
       e[t][0].call(o.exports, function(n) { 
        var o = e[t][1][n]; 
        return r(o || n) 
       }, o, o.exports) 
      } 
      return n[t].exports 
     } 
     if ("function" == typeof __nr_require) return __nr_require; 
     for (var o = 0; o < t.length; o++) r(t[o]); 
     return r 
    }({ 
     1: [function(e, n, t) { 
      function r() {} 

      function o(e, n, t) { 
       return function() { 
        return i(e, [c.now()].concat(u(arguments)), n ? null : this, t), n ? void 0 : this 
       } 
      } 
      var i = e("handle"), 
       a = e(2), 
       u = e(3), 
       f = e("ee").get("tracer"), 
       c = e("loader"), 
       s = NREUM; 
      "undefined" == typeof window.newrelic && (newrelic = s); 
      var p = ["setPageViewName", "setCustomAttribute", "setErrorHandler", "finished", "addToTrace", "inlineHit", "addRelease"], 
       d = "api-", 
       l = d + "ixn-"; 
      a(p, function(e, n) { 
       s[n] = o(d + n, !0, "api") 
      }), s.addPageAction = o(d + "addPageAction", !0), s.setCurrentRouteName = o(d + "routeName", !0), n.exports = newrelic, s.interaction = function() { 
       return (new r).get() 
      }; 
      var m = r.prototype = { 
       createTracer: function(e, n) { 
        var t = {}, 
         r = this, 
         o = "function" == typeof n; 
        return i(l + "tracer", [c.now(), e, t], r), 
         function() { 
          if (f.emit((o ? "" : "no-") + "fn-start", [c.now(), r, o], t), o) try { 
           return n.apply(this, arguments) 
          } finally { 
           f.emit("fn-end", [c.now()], t) 
          } 
         } 
       } 
      }; 
      a("setName,setAttribute,save,ignore,onEnd,getContext,end,get".split(","), function(e, n) { 
       m[n] = o(l + n) 
      }), newrelic.noticeError = function(e) { 
       "string" == typeof e && (e = new Error(e)), i("err", [e, c.now()]) 
      } 
     }, {}], 
     2: [function(e, n, t) { 
      function r(e, n) { 
       var t = [], 
        r = "", 
        i = 0; 
       for (r in e) o.call(e, r) && (t[i] = n(r, e[r]), i += 1); 
       return t 
      } 
      var o = Object.prototype.hasOwnProperty; 
      n.exports = r 
     }, {}], 
     3: [function(e, n, t) { 
      function r(e, n, t) { 
       n || (n = 0), "undefined" == typeof t && (t = e ? e.length : 0); 
       for (var r = -1, o = t - n || 0, i = Array(o < 0 ? 0 : o); ++r < o;) i[r] = e[n + r]; 
       return i 
      } 
      n.exports = r 
     }, {}], 
     4: [function(e, n, t) { 
      n.exports = { 
       exists: "undefined" != typeof window.performance && window.performance.timing && "undefined" != typeof window.performance.timing.navigationStart 
      } 
     }, {}], 
     ee: [function(e, n, t) { 
      function r() {} 

      function o(e) { 
       function n(e) { 
        return e && e instanceof r ? e : e ? f(e, u, i) : i() 
       } 

       function t(t, r, o, i) { 
        if (!d.aborted || i) { 
         e && e(t, r, o); 
         for (var a = n(o), u = m(t), f = u.length, c = 0; c < f; c++) u[c].apply(a, r); 
         var p = s[y[t]]; 
         return p && p.push([b, t, r, a]), a 
        } 
       } 

       function l(e, n) { 
        v[e] = m(e).concat(n) 
       } 

       function m(e) { 
        return v[e] || [] 
       } 

       function w(e) { 
        return p[e] = p[e] || o(t) 
       } 

       function g(e, n) { 
        c(e, function(e, t) { 
         n = n || "feature", y[t] = n, n in s || (s[n] = []) 
        }) 
       } 
       var v = {}, 
        y = {}, 
        b = { 
         on: l, 
         emit: t, 
         get: w, 
         listeners: m, 
         context: n, 
         buffer: g, 
         abort: a, 
         aborted: !1 
        }; 
       return b 
      } 

      function i() { 
       return new r 
      } 

      function a() { 
       (s.api || s.feature) && (d.aborted = !0, s = d.backlog = {}) 
      } 
      var u = "[email protected]", 
       f = e("gos"), 
       c = e(2), 
       s = {}, 
       p = {}, 
       d = n.exports = o(); 
      d.backlog = s 
     }, {}], 
     gos: [function(e, n, t) { 
      function r(e, n, t) { 
       if (o.call(e, n)) return e[n]; 
       var r = t(); 
       if (Object.defineProperty && Object.keys) try { 
        return Object.defineProperty(e, n, { 
         value: r, 
         writable: !0, 
         enumerable: !1 
        }), r 
       } catch (i) {} 
       return e[n] = r, r 
      } 
      var o = Object.prototype.hasOwnProperty; 
      n.exports = r 
     }, {}], 
     handle: [function(e, n, t) { 
      function r(e, n, t, r) { 
       o.buffer([e], r), o.emit(e, n, t) 
      } 
      var o = e("ee").get("handle"); 
      n.exports = r, r.ee = o 
     }, {}], 
     id: [function(e, n, t) { 
      function r(e) { 
       var n = typeof e; 
       return !e || "object" !== n && "function" !== n ? -1 : e === window ? 0 : a(e, i, function() { 
        return o++ 
       }) 
      } 
      var o = 1, 
       i = "[email protected]", 
       a = e("gos"); 
      n.exports = r 
     }, {}], 
     loader: [function(e, n, t) { 
      function r() { 
       if (!x++) { 
        var e = h.info = NREUM.info, 
         n = d.getElementsByTagName("script")[0]; 
        if (setTimeout(s.abort, 3e4), !(e && e.licenseKey && e.applicationID && n)) return s.abort(); 
        c(y, function(n, t) { 
         e[n] || (e[n] = t) 
        }), f("mark", ["onload", a() + h.offset], null, "api"); 
        var t = d.createElement("script"); 
        t.src = "https://" + e.agent, n.parentNode.insertBefore(t, n) 
       } 
      } 

      function o() { 
       "complete" === d.readyState && i() 
      } 

      function i() { 
       f("mark", ["domContent", a() + h.offset], null, "api") 
      } 

      function a() { 
       return E.exists && performance.now ? Math.round(performance.now()) : (u = Math.max((new Date).getTime(), u)) - h.offset 
      } 
      var u = (new Date).getTime(), 
       f = e("handle"), 
       c = e(2), 
       s = e("ee"), 
       p = window, 
       d = p.document, 
       l = "addEventListener", 
       m = "attachEvent", 
       w = p.XMLHttpRequest, 
       g = w && w.prototype; 
      NREUM.o = { 
       ST: setTimeout, 
       CT: clearTimeout, 
       XHR: w, 
       REQ: p.Request, 
       EV: p.Event, 
       PR: p.Promise, 
       MO: p.MutationObserver 
      }; 
      var v = "" + location, 
       y = { 
        beacon: "bam.xxxxxxxxx.net", 
        errorBeacon: "bam.xxxxxxxxx.net", 
        agent: "js-agent.newrelic.com/nr-1026.min.js" 
       }, 
       b = w && g && g[l] && !/CriOS/.test(navigator.userAgent), 
       h = n.exports = { 
        offset: u, 
        now: a, 
        origin: v, 
        features: {}, 
        xhrWrappable: b 
       }; 
      e(1), d[l] ? (d[l]("DOMContentLoaded", i, !1), p[l]("load", r, !1)) : (d[m]("onreadystatechange", o), p[m]("onload", r)), f("mark", ["firstbyte", u], null, "api"); 
      var x = 0, 
       E = e(4) 
     }, {}] 
    }, {}, ["loader"]); 
</script> 
    <title>Runtime Error</title> 
    <meta name="viewport" content="width=device-width" /> 
    <style> 
    body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
    p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} 
    b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} 
    H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } 
    H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } 
    pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} 
    .marker {font-weight: bold; color: black;text-decoration: none;} 
    .version {color: gray;} 
    .error {margin-bottom: 10px;} 
    .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } 
    @media screen and (max-width: 639px) { 
     pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; } 
    } 
    @media screen and (max-width: 479px) { 
     pre { width: 280px; } 
    } 
    </style> 
</head> 

<body bgcolor="white"> 

     <span><H1>Server Error in '/TeamAPI' Application.<hr width=100% size=1 color=silver></H1> 

     <h2> <i>Runtime Error</i> </h2></span> 

     <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> 

     <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 
     <br><br> 

     <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a &lt;customErrors&gt; tag within a &quot;web.config&quot; configuration file located in the root directory of the current web application. This &lt;customErrors&gt; tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.<br><br> 

     <table width=100% bgcolor="#ffffcc"> 
      <tr> 
       <td> 
        <code><pre> 

&lt;!-- Web.Config Configuration File --&gt; 

&lt;configuration&gt; 
    &lt;system.web&gt; 
     &lt;customErrors mode=&quot;Off&quot;/&gt; 
    &lt;/system.web&gt; 
&lt;/configuration&gt;</pre></code> 

        </td> 
       </tr> 
      </table> 

      <br> 

      <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the &quot;defaultRedirect&quot; attribute of the application&#39;s &lt;customErrors&gt; configuration tag to point to a custom error page URL.<br><br> 

      <table width=100% bgcolor="#ffffcc"> 
       <tr> 
        <td> 
         <code><pre> 

&lt;!-- Web.Config Configuration File --&gt; 

&lt;configuration&gt; 
    &lt;system.web&gt; 
     &lt;customErrors mode=&quot;RemoteOnly&quot; defaultRedirect=&quot;mycustompage.htm&quot;/&gt; 
    &lt;/system.web&gt; 
&lt;/configuration&gt;</pre></code> 

        </td> 
       </tr> 
      </table> 

      <br> 

    </body> 
</html> 

回答

0

我認爲它可能抱怨這一點:

< t.length; 

它對待<爲表明元素開始標記預期;然後它讀取空格字符以查找元素名稱;它然後驗證t.length;作爲元素名稱,並將其報告爲無效,因爲名稱不能包含分號。

要麼逸出<&lt;(以及類似的<&任何其他的出現;或包圍腳本元素在CDATA內容:

<script type="text/javascript"><![CDATA[.....]]></script>