成都创新互联网站制作重庆分公司

XML代码编写的编码与验证问题都有什么

XML代码编写的编码与验证问题都有什么?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

创新互联公司专注于烈山企业网站建设,成都响应式网站建设公司,购物商城网站建设。烈山网站建设公司,为烈山等地区提供建站服务。全流程按需求定制网站,专业设计,全程项目跟踪,创新互联公司专业和态度为您提供的服务

编码

编码就是转换 Unicode 字符为等价二进制表示的过程。XML 处理程序读取一个 XML 文档时,它依赖于编码类型来编码文档。因此,我们需要在 XML 声明中指定编码类型。

编码类型
主要有两种类型的编码:

UTF-8
UTF-16
UTF 表示 UCS 转换格式,而 UCS 本身的意义是通用字符集。编号 8 或者 16 表示呈现字符的比特数。它们是 8(一个字节)或者 16(两个字节)。对于没有编码信息的文档,默认使用 UTF-8。

语法
编码信息包含在 XML 文档的序言部分。UTF-8 编码的语法如下:

UTF-16 编码语法如下:

示例

下面的例子展示了编码声明:

  
  
    Tanmay Patil  
    TutorialsPoint  
    (011) 123-4567  

在上面的 encoding="UTF-8" 示例中,指定使用 8 位表示字符。要使用 16 为表示字符,可以使用 UTF-16 编码。

使用 UTF-8 编码的 XML 文件尺寸比 UTF-16 格式的文件更小。

验证

验证 就是对 XML 文档进行验证的过程。如果文档内容与元素,属性和关联的文档类型定义(DTD)匹配,以及文档符合b表达的约束则该文档被认为是有效的。通过 XML 解析器处理验证的方式有两种。分别是:

格式良好的 XML 文档
有效的 XML 文档
格式良好的 XML 文档
如果 XML 文档遵守以下规则则被认为是格式良好的。

没有 DTD 的 XML 文档必须使用预定义的字符实体处理 amp(&),apos(单引号),g(>),quot(双引号)。
必须遵循标签的顺序,比如内部标签必须在外部标签闭合之前闭合。
每个开始标签必须都有一个结束标签或者必须是一个自闭合标签(... 或者 )。<br/>在开始标签中必须只能有一个属性,并且需要使用引号包裹。<br/>除了amp(&),apos(单引号),g(>),quot(双引号)实体之外其他的必须先声明再使用。<br/>示例</p><p>下面是一个格式良好的 XML 文档示例:</p><pre><?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE address [ <!ELEMENT address (name,company,phone)> <!ELEMENT name (#PCDATA)> <!ELEMENT company (#PCDATA)> <!ELEMENT phone (#PCDATA)> ]> <address> <name>Tanmay Patil</name> <company>TutorialsPoint</company> <phone>(011) 123-4567</phone> </address></pre><p>上面的示例被认为是格式良好的,因为:</p><p>它定义了文档类型。并且这里文档类型是元素类型。<br/>包含一个名为 address 的根元素。<br/>每个子元素 name,company 和 phone 都是一个自解释正确闭合的标签。<br/>标签的顺序正确。</p><p>看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。</p> <br> 文章标题:XML代码编写的编码与验证问题都有什么 <br> 本文路径:<a href="http://cxhlcq.com/article/jpsihp.html">http://cxhlcq.com/article/jpsihp.html</a> </div> </div> </div> <div class="other container"> <h3>其他资讯</h3> <ul> <li> <a href="/article/dsdpcdi.html">大数据与nosql的关系,nosql在大数据体系中的作用</a> </li><li> <a href="/article/dsdpsdj.html">nosql是怎么实现的,NoSQL是一种</a> </li><li> <a href="/article/dsdpcgp.html">php怎么查询mysql,PHP怎么查询支付宝userID</a> </li><li> <a href="/article/dsdpsdo.html">android图标修改,安卓更改图标</a> </li><li> <a href="/article/dsdpsdi.html">nosql查询多条数据库,nosql 查询</a> </li> </ul> </div> <div class="footer"> <div class="foota container"> <div class="foot_nav fl col-lg-8 col-md-8 col-sm-12 col-xs-12"> <ul> <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>网站制作</h3> <a href="http://www.cxjianzhan.com/" target="_blank">网站制作</a><a href="http://www.dzwzjz.com/" target="_blank">达州网站制作</a><a href="https://www.cdxwcx.com/wangzhan/mbqiye.html" target="_blank">成都企业网站制作</a><a href="https://www.cdcxhl.com/" target="_blank">网站制作</a><a href="http://chengdu.xwcx.net/mobile/" target="_blank">移动手机网站制作</a><a href="http://m.cdcxhl.com/" target="_blank">成都网站制作</a> </li> <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>企业服务</h3> <a href="https://www.cdcxhl.com/link/" target="_blank">链接买卖</a><a href="https://www.cdcxhl.com/weihu/chengdu.html" target="_blank">成都网站维护</a><a href="https://www.cdcxhl.com/ruanwen/yingxiao/" target="_blank">软文推广</a><a href="https://www.cdcxhl.com/mianfei/jianzhan/" target="_blank">免费建站模板</a><a href="https://www.cdcxhl.com/link/" target="_blank">买友情链接</a><a href="https://www.cdcxhl.com/shoulu/" target="_blank">分类目录网站</a> </li> <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>网站建设</h3> <a href="http://www.cdkjz.cn/" target="_blank">网站建设</a><a href="http://www.cdxtjz.cn/" target="_blank">成都网站建设</a><a href="http://m.cdcxhl.cn/H5/" target="_blank">成都响应式网站建设</a><a href="http://www.cxjianzhan.com/" target="_blank">成都网站建设</a><a href="http://m.cdcxhl.cn/mobile/" target="_blank">网站建设公司</a><a href="http://www.kswsj.cn/" target="_blank">成都网站建设</a> </li> <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>服务器托管</h3> <a href="http://www.cdfuwuqi.com/" target="_blank">服务器托管机房</a><a href="https://www.cdxwcx.com/jifang/guanghua.html" target="_blank">光华服务器托管</a><a href="https://www.cdcxhl.com/jigui/" target="_blank">服务器机柜租赁</a><a href="http://www.cdfuwuqi.com/tuoguan/duoxian/" target="_blank">多线服务器托管</a><a href="https://www.cdxwcx.com/jifang/xiyun.html" target="_blank">成都西云机房</a><a href="https://www.cdcxhl.com/idc/cqst.html" target="_blank">重庆电信水土机房托管</a> </li> </ul> </div> <div class="footar fl col-lg-4 col-md-4 col-sm-12 col-xs-12"> <p>全国免费咨询:</p> <b>400-028-6601</b> <p>业务咨询:028-86922220 / 13518219792</p> <p>节假值班:18980820575 / 13518219792</p> <p>联系地址:成都市太升南路288号锦天国际A幢1002号</p> </div> </div> <div class="footb"> <div class="copy container"> <div class="fl">Copyright © 成都创新互联科技有限公司重庆分公司 <a href="https://beian.miit.gov.cn/" target="_blank">渝ICP备2021005571号</a></div> <!--<div class="fr"><a href="https://www.cdxwcx.com/" target="_blank">成都网站建设</a>:<a href="https://www.cdcxhl.com/" target="_blank">创新互联</a></div>--> </div> </div> <div class="link"> <div class="container"> 友情链接:: <a href="https://www.cdcxhl.com/" target="_blank">成都网站建设</a> <a href="https://www.cdcxhl.com/city/chongqing.html" target="_blank">重庆网站建设</a> <a href="">四川网站建设</a> <a href="">重庆建设网站</a> <a href="https://www.cdxwcx.com/jifang/xiyun.html" target="_blank">移动服务器托管</a> <a href="http://www.cdfuwuqi.com/" target="_blank">成都服务器托管</a> <a href="https://www.cdcxhl.cn/" target="_blank">云服务器</a> <a href="http://www.cdhuace.com/" target="_blank">广告设计制作</a> <a href="https://www.cdcxhl.com/sheji/chongqing.html" target="_blank">重庆网页设计</a> <a href="https://www.cdcxhl.com/zuo/chongqing.html" target="_blank">重庆做网站</a> <a href="https://www.cdcxhl.com/zhizuo/chongqing.html" target="_blank">重庆网站制作</a> <a href="">重庆网站建设</a> <a href="">重庆网站公司</a> <a href="">渝中网站制作</a> <a href="">重庆网站设计</a> </div> </div> </div> <div class="foot"> <ul class="public-celan"> <li> <a href="https://p.qiao.baidu.com/cps3/chatIndex?siteToken=6ce441ff9e2d6bedbdfc2a4138de449e&speedLogId=162260383240185e3_1622603832401_02407&eid=6256368&reqParam=%7B%22from%22%3A1%2C%22sessionid%22%3A%22-100%22%2C%22siteId%22%3A%2211284691%22%2C%22tid%22%3A%22-1%22%2C%22userId%22%3A%226256368%22%2C%22ttype%22%3A1%2C%22pageId%22%3A0%7D" target="_blank" class="a1 db tc"> <img src="/Public/Home/img/icon-23.png" alt="" class="db auto"> <span class="span-txt">在线咨询</span> </a> </li> <li> <a href="tel:18980820575" class="a1 db tc"> <img src="/Public/Home/img/icon-24.png" alt="" class="db auto"> <span class="span-txt">电话咨询</span> </a> </li> <li> <a target="_blank" href="tencent://message/?uin=1683211881&Site=&Menu=yes" class="a1 db tc"> <img src="/Public/Home/img/icon-25.png" alt="" class="db auto"> <span class="span-txt">QQ咨询</span> </a> </li> <li> <a target="_blank" href="tencent://message/?uin=532337155&Site=&Menu=yes" class="a1 db tc public-yuyue-up"> <img src="/Public/Home/img/icon-26.png" alt="" class="db auto"> <span class="span-txt">预约顾问</span> </a> </li> </ul> </div> <div class="customer"> <dl class="icon1"> <dt> <a href="tencent://message/?uin=1683211881&Site=&Menu=yes"> <i class="iconT"><img src="/Public/Home/img/QQ.png" alt=""></i> <p>在线咨询</p> </a> </dt> </dl> <dl class="icon2"> <dt><i><img src="/Public/Home/img/weixin.png" alt=""></i><p>微信咨询</p></dt> <dd><img src="/Public/Home/img/ewm.png"></dd> </dl> <dl class="icon3"> <dt><i><img src="/Public/Home/img/dianhua.png" alt=""></i><p>电话咨询</p></dt> <dd> <p>028-86922220(工作日)</p> <p>18980820575(7×24)</p> </dd> </dl> <dl class="icon4"> <dt class="sShow"> <a href="tencent://message/?uin=244261566&Site=&Menu=yes"> <i><img src="/Public/Home/img/dengji.png" alt=""></i><p>提交需求</p> </a> </dt> </dl> <dl class="icon5"> <dt class="gotop"> <a href="#top"> <i><img src="/Public/Home/img/top.png" alt=""></i><p>返回顶部</p> </a> </dt> </dl> </div> </body> </html> <script> $(".con img").each(function(){ var src = $(this).attr("src"); //获取图片地址 var str=new RegExp("http"); var result=str.test(src); if(result==false){ var url = "https://www.cdcxhl.com"+src; //绝对路径 $(this).attr("src",url); } }); window.onload=function(){ document.oncontextmenu=function(){ return false; } } </script>