<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 服務器上的 XML XML 文件是類似 HTML 文件的純文本文件。 XML 能夠通過標準的 Web 服務器輕松地存儲和生成。 ## 在服務器上存儲 XML 文件 XML 文件在 Internet 服務器上進行存儲的方式與 HTML 文件完全相同。 啟動 Windows 記事本,并寫入以下行: ``` <?xml version="1.0" encoding="ISO-8859-1"?> <note> <from>Jani</from> <to>Tove</to> <message>Remember me this weekend</message> </note> ``` 然后用適當的文件名,比如 "note.xml",在 Web 服務器上保存這個文件。 ## 通過 ASP 生成 XML XML 可在不安裝任何 XML 軟件的情況下在服務器端生成。 如需從服務器生成 XML 響應 - 只需簡單地編寫以下代碼并在 Web 服務器上把它保存為一個 ASP 文件: ``` <% response.ContentType="text/xml" response.Write("<?xml version='1.0' encoding='ISO-8859-1'?>") response.Write("<note>") response.Write("<from>Jani</from>") response.Write("<to>Tove</to>") response.Write("<message>Remember me this weekend</message>") response.Write("</note>") %> ``` 請注意,此響應的內容類型必須設置為 "text/xml"。 [查看這個 ASP 文件如何從服務器返回](/try/xml/note.asp.xml)。 如果您想要學習 ASP,請在我們的[首頁](/)查找 ASP 教程。 ## 通過 PHP 生成 XML 如需使用 PHP 從服務器上生成 XML 響應,請使用下面的代碼: ``` <?php header("Content-type: text/xml"); echo "<?xml version='1.0' encoding='ISO-8859-1'?>"; echo "<note>"; echo "<from>Jani</from>"; echo "<to>Tove</to>"; echo "<message>Remember me this weekend</message>"; echo "</note>"; ?> ``` 請注意,響應頭部的內容類型必須設置為 "text/xml"。 [查看這個 PHP 文件如何從服務器返回](/try/xml/note.php.xml)。 如果您想要學習 PHP,請在我們的[首頁](/)查找 PHP 教程。 ## 從數據庫生成 XML XML 可在不安裝任何 XML 軟件的情況下從數據庫生成。 如需從服務器生成 XML 數據庫響應,只需簡單地編寫以下代碼,并把它在 Web 服務器上保存為 ASP 文件: ``` <% response.ContentType = "text/xml" set conn=Server.CreateObject("ADODB.Connection") conn.provider="Microsoft.Jet.OLEDB.4.0;" conn.open server.mappath("/db/database.mdb") sql="select fname,lname from tblGuestBook" set rs=Conn.Execute(sql) response.write("<?xml version='1.0' encoding='ISO-8859-1'?>") response.write("<guestbook>") while (not rs.EOF) response.write("<guest>") response.write("<fname>" & rs("fname") & "</fname>") response.write("<lname>" & rs("lname") & "</lname>") response.write("</guest>") rs.MoveNext() wend rs.close() conn.close() response.write("</guestbook>") %> ``` [查看以上 ASP 文件的實際數據庫輸出](/try/xml/guestbook.asp.xml)。 上面的實例使用了帶有 ADO 的 ASP。 如果您想要學習 ASP 和 ADO,請在我們的[首頁](/)查找相關教程。 ## 在服務器上通過 XSLT 轉換 XML 下面的 ASP 代碼在服務器上把 XML 文件轉換為 XHTML: ``` <% 'Load XML set xml = Server.CreateObject("Microsoft.XMLDOM") xml.async = false xml.load(Server.MapPath("simple.xml")) 'Load XSL set xsl = Server.CreateObject("Microsoft.XMLDOM") xsl.async = false xsl.load(Server.MapPath("simple.xsl")) 'Transform file Response.Write(xml.transformNode(xsl)) %> ``` 實例解釋 * 第一個代碼塊創建微軟 XML 解析器的實例(XMLDOM),并把 XML 文件載入內存。 * 第二個代碼塊創建解析器的另一個實例,并把 XSL 文件載入內存。 * 最后一個代碼使用 XSL 文檔來轉換 XML 文檔,并把結果以 XHTML 發送到您的瀏覽器。 [看看上面的代碼怎么運行](/try/xml/simple.php)。 ## 通過 ASP 把 XML 保存為文件 這個 ASP 實例會創建一個簡單的 XML 文檔,并把該文檔保存到服務器上: ``` <% text="<note>" text=text & "<to>Tove</to>" text=text & "<from>Jani</from>" text=text & "<heading>Reminder</heading>" text=text & "<body>Don't forget me this weekend!</body>" text=text & "</note>" set xmlDoc=Server.CreateObject("Microsoft.XMLDOM") xmlDoc.async=false xmlDoc.loadXML(text) xmlDoc.Save("test.xml") %> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看