<bdo id='JJDq7'></bdo><ul id='JJDq7'></ul>
  • <tfoot id='JJDq7'></tfoot>

      <legend id='JJDq7'><style id='JJDq7'><dir id='JJDq7'><q id='JJDq7'></q></dir></style></legend>

        <i id='JJDq7'><tr id='JJDq7'><dt id='JJDq7'><q id='JJDq7'><span id='JJDq7'><b id='JJDq7'><form id='JJDq7'><ins id='JJDq7'></ins><ul id='JJDq7'></ul><sub id='JJDq7'></sub></form><legend id='JJDq7'></legend><bdo id='JJDq7'><pre id='JJDq7'><center id='JJDq7'></center></pre></bdo></b><th id='JJDq7'></th></span></q></dt></tr></i><div id='JJDq7'><tfoot id='JJDq7'></tfoot><dl id='JJDq7'><fieldset id='JJDq7'></fieldset></dl></div>

        <small id='JJDq7'></small><noframes id='JJDq7'>

      1. “XML Parsing Error: junk after document element"

        时间:2023-11-30
          <tbody id='Ymtnj'></tbody>
      2. <i id='Ymtnj'><tr id='Ymtnj'><dt id='Ymtnj'><q id='Ymtnj'><span id='Ymtnj'><b id='Ymtnj'><form id='Ymtnj'><ins id='Ymtnj'></ins><ul id='Ymtnj'></ul><sub id='Ymtnj'></sub></form><legend id='Ymtnj'></legend><bdo id='Ymtnj'><pre id='Ymtnj'><center id='Ymtnj'></center></pre></bdo></b><th id='Ymtnj'></th></span></q></dt></tr></i><div id='Ymtnj'><tfoot id='Ymtnj'></tfoot><dl id='Ymtnj'><fieldset id='Ymtnj'></fieldset></dl></div>

          <tfoot id='Ymtnj'></tfoot>

        • <legend id='Ymtnj'><style id='Ymtnj'><dir id='Ymtnj'><q id='Ymtnj'></q></dir></style></legend>

            <small id='Ymtnj'></small><noframes id='Ymtnj'>

              <bdo id='Ymtnj'></bdo><ul id='Ymtnj'></ul>

                1. 本文介绍了“XML Parsing Error: junk after document element"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  大家好,我正在尝试显示一个谷歌地图,其中包含从我关注的数据库中检索的动态位置 developer.google.com/maps/articles on phpsqlajax_v3.我创建了数据库,表格看起来像这样

                  Hey everyone I'm trying to display a Google map with dynamic locations retrieve from database I was following developers.google.com/maps/articles on phpsqlajax_v3.I created the database and the table looks like this

                  trnsportpublic 表

                  transportpublicid int 11 自动增量

                  transportpublicid int 11 AUTOINCREMENT

                  transportType varchar 60

                  transportType varchar 60

                  costPerKm 十进制(7,2)

                  costPerKm decimal(7,2)

                  地址 varchar 800

                  address varchar 800

                  teleNo int 10

                  teleNo int 10

                  webLink varchar 300

                  webLink varchar 300

                  描述 varchar 800

                  description varchar 800

                  纬度双(10,6)

                  lng double(10,6)

                  lng double(10,6)

                  GenerateXml.php

                   <?php
                  
                            require("db_connection.php");
                  
                  
                            function parseToXML($htmlStr) 
                            { 
                                $xmlStr=str_replace('<','&lt;',$htmlStr); 
                                $xmlStr=str_replace('>','&gt;',$xmlStr); 
                                $xmlStr=str_replace('"','&quot;',$xmlStr); 
                                $xmlStr=str_replace("'",'&#39;',$xmlStr); // line 11  
                                $xmlStr=str_replace("&",'&amp;',$xmlStr); 
                                return $xmlStr; 
                            } 
                  
                            // Select all the rows in the markers table
                            $query = "SELECT transportType,costPerKm,address,teleNo,webLink,lat,lng FROM transportpublic";
                  
                            $result = mysql_query($query);
                            if (!$result) 
                            {
                              die('Invalid query: ' . mysql_error());
                            }
                  
                            header("Content-type: text/xml");
                  
                            // Start XML file, echo parent node
                            echo '<transportpublic>';
                  
                            // Iterate through the rows, printing XML nodes for each
                            while ($row = mysql_fetch_assoc($result)){
                              // ADD TO XML DOCUMENT NODE
                              echo '<marker ';
                              echo 'transportType="' . parseToXML($row['transportType']) . '" ';
                              echo 'costPerKm="' . $row['costPerKm'] . '" ';
                              echo 'address="' . parseToXML($row['address']) . '" ';
                              echo 'teleNo="' . $row['teleNo'] . '" ';
                              echo 'webLink="' . parseToXML($row['webLink']) . '" ';
                              echo 'lat="' . $row['lat'] . '" ';
                              echo 'lng="' . $row['lng'] . '" ';
                              echo '/>';
                            }
                  
                            // End XML file
                            echo '</transportpublic>';
                      ?>
                  

                  当我在浏览器上运行 GenerateXml.php 时,我感到很兴奋

                  When I run GenerateXml.php on browser is gives me fillowing

                  XML Parsing Error: junk after document element
                  Location: http://localhost:8080/testserver/generateXml.php
                  Line Number 11, Column 8:
                  </html>
                  <transportpublic>
                  <marker transportType="Bus" costPerKm="1.50" address="abc" teleNo="112554476" webLink="http://www.abc.html" lat="0.000000" lng="0.000000" />
                  
                  <marker transportType="Train" costPerKm="12.00" address="abc" teleNo="118745963" webLink="http://www.abc.html" lat="0.000000" lng="0.000000" />
                  
                  <marker transportType="hmmmm" costPerKm="40.00" address="abc" teleNo="112541254" webLink="http://www.abc.html" lat="-33.005985" lng="-58.501824" />
                  
                  <marker transportType="test" costPerKm="2.00" address="abc" teleNo="112541258" webLink="http://www.abc.html" lat="39.785999" lng="-75.041976" />
                  
                  <marker transportType="test2" costPerKm="2.00" address="abc" teleNo="112541254" webLink="http://www.abc.html" lat="6.901698" lng="79.853854" />
                  
                  </transportpublic>
                  -------^ 
                  

                  <小时>

                  我只知道在根元素之后我不应该解析任何数据,它将被视为垃圾,但在我的 GenerateXml.php 中,我在此行之后不做任何事情


                  I only got to know that after the root element I shouldn't be parsing any data it'll be taken as junk but in my GenerateXml.php i don't do anything after this line

                  echo '</transportpublic>';
                  

                  <小时>

                  请帮帮我.


                  help me please.

                  推荐答案

                  根节点是<transportpublic> 但是错误信息显示一个伪造的</html> 在它之前关闭标签.XML 解析器可能认为 <html> 是根节点,因此 XML 的其余部分是错误提到的 文档元素之后的垃圾.

                  The root node is <transportpublic> but the error message shows a bogus </html> close tag right before it. The XML parser probably thinks that <html> is the root node, thus the rest of the XML is the junk after document element mentioned by the error.

                  这篇关于“XML Parsing Error: junk after document element"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 XMLReader 选择父节点 下一篇:带有 PHP DOMDocument 的 xml 空标签

                  相关文章

                  <legend id='Y6N83'><style id='Y6N83'><dir id='Y6N83'><q id='Y6N83'></q></dir></style></legend>

                  <tfoot id='Y6N83'></tfoot>
                  <i id='Y6N83'><tr id='Y6N83'><dt id='Y6N83'><q id='Y6N83'><span id='Y6N83'><b id='Y6N83'><form id='Y6N83'><ins id='Y6N83'></ins><ul id='Y6N83'></ul><sub id='Y6N83'></sub></form><legend id='Y6N83'></legend><bdo id='Y6N83'><pre id='Y6N83'><center id='Y6N83'></center></pre></bdo></b><th id='Y6N83'></th></span></q></dt></tr></i><div id='Y6N83'><tfoot id='Y6N83'></tfoot><dl id='Y6N83'><fieldset id='Y6N83'></fieldset></dl></div>

                2. <small id='Y6N83'></small><noframes id='Y6N83'>

                    <bdo id='Y6N83'></bdo><ul id='Y6N83'></ul>