【问题标题】:i get some error in sitemap xml type in laravel我在 laravel 中的站点地图 xml 类型中遇到一些错误
【发布时间】:2020-12-14 04:44:32
【问题描述】:

我的网站中的 xml 文件类型有问题

它工作正常,但现在我在文件的最后一行得到一些文本

new (class{constructor(e){this.client=window[Symbol.for(e)],this.bindEvents()}bindEvents(){const e=this;var t;history.pushState=(t=history.pushState,function(){const n=t.apply(this,arguments);return e.onUrlChange(),n});let n=!0;history.replaceState=(t=>function(s){var r=t.apply(this,arguments);return n||e.onUrlChange(),n=!1,r})(history.replaceState),window.addEventListener("hashchange",(function(){e.onUrlChange()}))}onUrlChange(){this.client.emitToBg("URLS_SAFE_CHECK__CONTENT_URL_REWRITED")}})('MARIO_POST_CLIENT_eppiocemhmnlbhjplcgkofciiegomcon')

我该如何解决?

【问题讨论】:

    标签: xml xml-parsing xmlhttprequest xml-error


    【解决方案1】:

    一些浏览器扩展正在添加该代码。如果您查看网络选项卡中的响应,您将看到该响应是正确的。我在使用 urbanVPN 扩展时遇到了同样的问题。

    【讨论】:

      【解决方案2】:

      将 css 文件连接到 xml 时遇到同样的问题。试试 xsl 样式表。 我的问题解决方案。

       <?xml version="1.0" encoding="UTF-8" ?>
      <xsl:stylesheet version="1.0" 
                      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output 
                    method="html" 
                    doctype-public="-//W3C//DTD HTML 4.01//EN" 
                    doctype-system="http://www.w3.org/TR/html4/strict.dtd" 
                    indent="yes" />
      
        <!-- 
          Шаблон корневого элемента
          -->
        <xsl:template match="/">
          <html>
      
          <head>
            <title>Наши книги</title>
            <style type="text/css">
              * {
                margin: 0px;
                padding: 0px
              }
              
              h1 {
                padding: 10px;
                text-align: center;
                background-color: #ccf
              }
              
              table {
                margin: 10px;
                border-collapse: collapse
              }
              
              td {
                border: 1px solid gray;
                padding: 5px
              }
              
              thead td {
                text-align: center;
                background-color: #ccf;
                font-weight: bold
              }
              
              #colTitle {
                width: 300px
              }
              
              #colAutor {
                width: 300px
              }
              
              #colPubYear {
                width: 100px
              }
              
              #colPrice {
                width: 100px
              }
              
              .expenceBook td {
                background-color: yellow
              }
            </style>
          </head>
      
          <body>
            <h1>Наши книги</h1>
            <table>
              <thead>
                <td id="colTitle">Наименование</td>
                <td id="colAutor">Автор</td>
                <td id="colPubYear">Год издания</td>
                <td id="colPrice">Цена</td>
              </thead>
              <tbody>
                <xsl:apply-templates select="/catalog/book" />
              </tbody>
            </table>
          </body>
      
          </html>
        </xsl:template>
        <!-- 
          Шаблон отрисовки книги стоимостью менее 200 руб.
          -->
        <xsl:template match="book[price &lt; 200]">
          <tr>
            <xsl:apply-templates select="./*" />
          </tr>
        </xsl:template>
        <!-- 
          Шаблон отрисовки книги стоимостью более 200 руб.
          -->
        <xsl:template match="book[price &gt; 200]">
          <tr class="expenceBook">
            <xsl:apply-templates select="./*" />
          </tr>
        </xsl:template>
        <!-- 
          Шаблон отрисовки дочерних элементов книги
          -->
        <xsl:template match="book/*">
          <td>
            <xsl:value-of select="." />
          </td>
        </xsl:template>
      </xsl:stylesheet>
      

      【讨论】:

        猜你喜欢
        • 2020-10-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-07
        • 2015-02-02
        • 1970-01-01
        • 2015-08-07
        相关资源
        最近更新 更多