• 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
  • 相关阅读:
    Mybatis 用Demo去入门 (使用数据库的查询操作测试)
    Spring Mvc 用Demo去学习
    OGNL的学习
    hibernate 运用 中的 细节分析
    pip3问题pip is configured with locations that require TLS/SSL, however the ssl module in Python is not avail
    更换centos7源
    Centos7下python2.7升级至3.6
    service adminsetd start
    kali更新源
    redhat7 配置使用centos的yum源
  • 原文地址:https://www.cnblogs.com/jasonxu19900827/p/6019551.html
Copyright © 2020-2023  润新知