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

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
PCI Perspectives
PCI Perspectives
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
量子位
博客园_首页
S
SegmentFault 最新的问题
S
Secure Thoughts
F
Full Disclosure
H
Hacker News: Front Page
博客园 - 三生石上(FineUI控件)
U
Unit 42
H
Heimdal Security Blog
N
News and Events Feed by Topic
A
About on SuperTechFans
C
CERT Recently Published Vulnerability Notes
Cyberwarzone
Cyberwarzone
Help Net Security
Help Net Security
The Hacker News
The Hacker News
L
LINUX DO - 最新话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
罗磊的独立博客
N
News | PayPal Newsroom
Spread Privacy
Spread Privacy
C
Cisco Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
云风的 BLOG
云风的 BLOG
A
Arctic Wolf
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Simon Willison's Weblog
Simon Willison's Weblog
B
Blog
人人都是产品经理
人人都是产品经理
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
I
InfoQ
D
DataBreaches.Net
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
L
LINUX DO - 热门话题
Google Online Security Blog
Google Online Security Blog
V
Visual Studio Blog
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
B
Blog RSS Feed

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...