惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
腾讯CDC
G
Google Developers Blog
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
有赞技术团队
有赞技术团队
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
M
MIT News - Artificial intelligence
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
美团技术团队
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志

XML | 酷 壳 - CoolShell

PFIF网上寻人协议 | 酷 壳 - CoolShell 语言的数据亲和力 | 酷 壳 - CoolShell Web开发人员速查卡 | 酷 壳 - CoolShell 那些炒作过度的技术和概念 | 酷 壳 - CoolShell SOAP的S是Simple | 酷 壳 - CoolShell 信XML,得自信 | 酷 壳 - CoolShell 早期XML Schema中的open content模型 | 酷 壳 - CoolShell
信XML,得永生! | 酷 壳 - CoolShell
陈皓 · 2010-06-09 · via XML | 酷 壳 - CoolShell

在计算机的世界里,什么最牛?JavascriptC语言C++iPad?还是brainfuck?我个人觉得都不是,这个世界里,XML最NB,这世界到处都充斥着XML,正如在“十条不错的编程观点”文中所说,我们不用XML我们都不知道怎么编程了。下面,让我们来看一看XML的几个真实的示例,相信你会同意我的观点的。

一、如何用XML返回数据库SQL查询结果

<?xml version="1.0" encoding="iso-8859-1" ?>
<result>
  <fields>
    <field>NAME</field>
    <field>LAST NAME</field>
    <field>MOTHER MAIDEN NAME</field>
    <field>BIRTHDATE</field>
    ...
  </fields>
  <data>
    <row>
      <value>MARLENE</value>
      <value>RUTH</value>
      <value>DE MARCO</value>
      <value>1973-02-24 00:00:00</value>
      ...
    </row>
  </data>
</result>

二、如何用XML序列化一个图片

<attachments xmlns = "http://webservices..." >
  <bytes>37</bytes>
  <bytes>80</bytes>
  <bytes>68</bytes>
  <bytes>70</bytes>
  <bytes>45</bytes>
  <bytes>49</bytes>
  <bytes>46</bytes>
  <bytes>52</bytes>
  <bytes>10</bytes>
  <bytes>37</bytes>
  <bytes>-30</bytes>
  <bytes>-29</bytes>
  <bytes>-49</bytes>
  <bytes>-45</bytes>
  <bytes>10</bytes>
  <bytes>52</bytes>
  <bytes>32</bytes>
  <bytes>48</bytes>
  <bytes>32</bytes>
  <bytes>111</bytes>
  ...
  ...
  ...

三、如何让XML与CSV格式兼容

<?xml version="1.0" encoding="iso8859-1" ?>
<import tag="1stTEST" type="data" mode="update">
<options>
    <dateformat mmddyyyy="true"/>
        <notification>
            <EMail>[email protected]</EMail>
        </notification>
    </options>
    <fields>
        <field name="name" type="char" mapsto="person.data"/>
        <field name="officeid" type="char" mapsto="custom.locationid"/>
        <field name="startyear" type="char" mapsto="person.yearstarted"/>
        <field name="personelid" type="int" mapsto="person.id"/>
        <field name="dob" type="date" mapsto="person.dateofbith"/>
        <field name="sex" type="char" mapsto="person.sex"/>
        <field name="modified" type="date" mapsto="record.modified"/>
    </fields>
    <csvdata columnheaders="false">
<![CDATA[
"Jack Wade",214,2002,111012,07/04/1975,"M",02/11/2006
"Sam Davidson",214,1999,104841,10/15/1967,"M",02/10/2006
"Denise V Law",214,1998,104660,01/21/1971,"F",02/17/2006
"Lisa Blake",214,1989,100987,08/01/1982,"F",01/21/2006
"Andrew Match",214,1991,101074,12/25/1980,"M",02/28/2006
]]>
    </csvdata>
</import>

四、如何把XML当成数组来用

<rootNode>
   <numberOfAddresses>110</numberOfAddresses>
   <address_1>442 Fake St.</address_1>
   <address_2>61 Main St.</address_2>
   ...
   ...
   ...
   <address_110>3881 N 4th Ave. #5D</address_110>
</rootNode>

相信你一定有比这更牛X的例子,欢迎与我们分享!

Loading...