zoukankan      html  css  js  c++  java
  • ios开发 学习积累20161101

    20161101

    XML的声明

    1 <?XML version="1.0" encoding="UTF-8" ?>

    XML文档必须有根元素

    XML 对大小写敏感

    所有XML元素必须有关闭标签

    XML文档必须加引号

     

    XML中,一些字符拥有特殊的意义,需要实体引用。

     XML 中,有 5 个预定义的实体引用:

    &lt; < 小于

    &gt; > 大于

    &amp; & 和号

    &apos; ' 单引号

    &quot; " 引号

     

    XML的注释

    <!— This is a comment —>

    XML中空格会被保留

     

    尽量使用元素来描述数据,而仅仅使用属性来提供与数据无关的信息。

    元数据应当存储为属性(数据的数据),数据本身应当存储为元素。

     

    XML验证

    http://www.w3school.com.cn/xml/xml_validator.asp

    通过测试谷歌浏览器不能提示错误,火狐浏览器可以提示错误

     

    XML Javascript

    创建XMLHttpRequest 对象的语法

    1 xmlhttp = new XMLHttpRequest();

    老版本的internetExplorer (IE5和IE6)使用ActiveX对象

    1 xmlhttp = new ActiveXObject(“Microsoft.XMLHTTP”);

    实例

     TEST.html 

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4     <title></title>
     5     <script type="text/javascript">
     6         var xmlhttp;
     7         function loadXmlDoc(url){
     8             if (window.XMLHttpRequest) {
     9                 xmlhttp = new XMLHttpRequest();
    10             }else if(window.ActiveXObject){
    11                 xmlhttp = new ActiveXObject();
    12             }
    13             if (xmlhttp != null) {
    14                 xmlhttp.onreadystatechange = state_change;
    15                 xmlhttp.open("GET",url,true);
    16                 xmlhttp.send(null);
    17             }else{
    18                 alert("Your browser does not supprot XMLHTTP.");
    19             }
    20         }
    21         function state_change(){
    22             if (xmlhttp.readyState == 4){
    23                 //4 = "loaded"
    24                 if (xmlhttp.status == 200) {
    25                     //200 = "OK"
    26                     document.getElementById('A1').innerHTML = xmlhttp.status;
    27                     document.getElementById('A2').innerHTML = xmlhttp.statusText;
    28                     document.getElementById('A3').innerHTML = xmlhttp.responseText;
    29                 }else{
    30                     alert("Problem retrieving XML data:" + xmlhttp.statusText);
    31                 }
    32             }
    33         }
    34     </script>
    35 </head>
    36 <body>
    37     <h2>Using the HttpRequest Object</h2>
    38     <p><b>Status:</b>
    39     <span id="A1"></span>
    40     </p>
    41 
    42     <p><b>Status text:</b>
    43     <span id="A2"></span>
    44     </p>
    45 
    46     <p><b>Response:</b>
    47     <br /><span id="A3"></span>
    48     </p>
    49     <button onclick="loadXmlDoc('/note.xml')">Get XML</button>
    50 </body>
    51 </html>
    View Code

    note.xml

    1 <?xml version="1.0" encoding="UTF-8"?>
    2 <note>
    3 <to>George</to>
    4 <from>John</from>
    5 <heading>Reminder</heading>
    6 <body>Don't forget the meeting!</body>
    7 </note>
    View Code
  • 相关阅读:
    luogu 1865 数论 线性素数筛法
    洛谷 2921 记忆化搜索 tarjan 基环外向树
    洛谷 1052 dp 状态压缩
    洛谷 1156 dp
    洛谷 1063 dp 区间dp
    洛谷 2409 dp 月赛题目
    洛谷1199 简单博弈 贪心
    洛谷1417 烹调方案 dp 贪心
    洛谷1387 二维dp 不是特别简略的题解 智商题
    2016 10 28考试 dp 乱搞 树状数组
  • 原文地址:https://www.cnblogs.com/jasonxu19900827/p/6019551.html
Copyright © 2011-2022 走看看