問(wèn)題描述
我有一個(gè)類(lèi)似的問(wèn)題:https://superuser.com/questions/140242/why-my-browsers-display-xml-files-as-blank-pages?rq=1
我在瀏覽器中沒(méi)有看到我的 xml,而只是一個(gè)空白頁(yè)面.我只檢查了 Chrome 和 firefox,但兩者都發(fā)生了.不同之處在于我從 MySQL 獲取數(shù)據(jù)并對(duì)其進(jìn)行響應(yīng).所以文件擴(kuò)展名是 .php 而不是 .xml
I don't see my xml in my browser, but just a blank page. I only checked Chrome and firefox, but it's happening in both. The difference is that I'm getting data from MySQL and echoing it. So the file extension is .php and not .xml
$row = mysqli_fetch_assoc($resource);
echo "<?xml version="1.0" encoding="UTF-8"?>
";
echo "<video>
";
echo "<path>" . $row['path'] . "</path>
";
echo "</video>
";
當(dāng)我轉(zhuǎn)到 url 時(shí)看到一個(gè)空白頁(yè).但是當(dāng)我查看源代碼"時(shí),我看到了 xml 樹(shù).
I see a blank page when I go to the url. But when I "View Source", I see the xml tree.
<video>
<path>URLtoVideo.mp4</path>
</video>
我的主要目標(biāo)是獲取 xml 數(shù)據(jù)并使用 URLRequest() 在 Flash 中請(qǐng)求它.但是我收到這個(gè)錯(cuò)誤
My main goal is to grab the xml data and request it in Flash using URLRequest(). But I get this error
TypeError: Error #1088: The markup in the document following the root element must be well-formed.
我認(rèn)為這可能是我在 Flash 中遇到的錯(cuò)誤的問(wèn)題.我只有一個(gè)根節(jié)點(diǎn),我認(rèn)為我的子節(jié)點(diǎn)沒(méi)有任何問(wèn)題.所以我唯一的假設(shè)是錯(cuò)誤是因?yàn)榭瞻醉?yè).
I think this may be the problem to the error I get in Flash. I only have one root node, and I don't think I have any problems with the child nodes. So my only assumption is that the error occurs because of the blank page.
推薦答案
XML 未顯示,因?yàn)闉g覽器會(huì)對(duì)其進(jìn)行解釋.
The XML is not displayed because the browser interpret it.
寫(xiě)作時(shí)
<table></table>
在您的 HTML 頁(yè)面中,您不會(huì)看到字符串
In your HTML page, you will not see the string
"<table><table>"
但是一張空桌子.
這與 XML 內(nèi)容相同.
This is the same things about XML content.
另一個(gè)堆棧溢出帖子得到了這個(gè)答案這里
Another Stack overflow post got an answer to this HERE
這里我復(fù)制了mellamokb的回答
Here I copy past the answer of mellamokb
簡(jiǎn)單的解決方案是嵌入元素內(nèi)部,這將保留格式和尖括號(hào).我也有刪除了 style="border:none;" 的邊框這使得 textarea看不見(jiàn).
Simple solution is to embed inside of a element, which will preserve both the formatting and the angle brackets. I have also removed the border with style="border:none;" which makes the textarea invisible.
這是一個(gè)示例:xxxx
Here is a sample: xxxx
這篇關(guān)于在 PHP 中回顯 xml 會(huì)在瀏覽器中顯示空白頁(yè)面的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!