文章

顯示包含「XML」標籤的文章

以前上課老師的資料AJAX 簡介

  *早期AJAX沒有成為標準前是另外一個視窗到螢幕看不到的地方處理完成後再自己關閉 *也些JQuery做的套件處理語法會不太一樣 全名Asynchronous JavaScript And XML  主要特性  在網頁載入完成後後容可以從伺服器讀取資料  不需要重新載入即可更新網頁資料  由背景將資料傳送到伺服器端  在用戶端執行 客戶端-網頁瀏覽器 1.事件產生 2.JavaScript 建立 XMLHttpRequest 3.送出 HttpRequest 伺服器端 4. 處理 Request 5. 傳回 Response 客戶端-網頁瀏覽器 6. JavaScript 接收資料 7. 更新網頁資料 AJAX 範例 利用AJAX從伺服器中讀取內容並顯示  HTML 部分 <div id="demo"> <h2>目前顯示的文字</h2> <button type="button" onclick="getNewText()">更改文字 </button> </div> JavaScript部分 <script type='text/javascript'> function getNewText() { // 建立XMLhttpRequest物件 var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { // 確定請求順利完成 if (this.readyState == 4 && this.status == 200) { // 更改網頁內容 document.getElementById("demo").innerHTML = this.responseText; } }; // 設定請求類型 xhttp.open("GET", "demo.txt", true); // 送出請求 xhttp.send(); } </script> AJAX Request GET模式 請求格式 xhttp.open("G...

C#.NET程式JSON字串轉XML

 環境VS2010 .net 4.0   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 using System ; using System.Collections.Generic ; using System.Linq ; using System.Text ; using System.Data.SqlClient ; using System.Data ; using System.Xml ; namespace ConsoleApplication1 { class Program { static void Main ( string [] args ) { String sss = "{ \"firstName\": \"John\", \"lastName\": \"Smith\", \"sex\": \"third\", \"age\": 25, \"address\": { \"streetAddress\": \"21 2nd Street\", \"city\": \"New York\", \"state\": \"NY\", \"postalCode\": \"10021\" }, \"phoneNumber\": [ ...

以前上課老師講的資料 XML 介紹

  XML 介紹 可延伸標示語言(eXtensible Markup Language)  讓人方便閱讀,又容易使電腦讀取  整份文件可以視為一個實體文件(Entity)  其結構為樹狀結構,由元素與標籤組成  起始標籤可以有屬性 (attribute) <?xml version="1.0" encoding="utf-8"?>//XML 宣告  <namecard> <name>Learry Lee</name> <tel>04-23456789</tel> <email href="mailto:learry@gmail.com"/> </namecard> PHP SimpleXML $xmlData = "<?xml version='1.0' encoding='UTF-8'?> <note> <to>John</to> <from>Mary</from> <title>Reminder</title> <body>'Don't forget me this weekend!</body> </note>"; $xml = simplexml_load_string($xmlData); echo $xml->to; echo $xml->from; echo $xml->title; echo $xml->body; 轉換錯誤檢查 libxml_use_internal_errors(true); $xmlData = "<?xml version='1.0' encoding='UTF-8'?> <note> <to>John</to> <from>Mary</from> <title>Reminder</wrongtitle> ...