24小时热门版块排行榜    

查看: 213  |  回复: 1
【奖励】 本帖被评价1次,作者arqiu增加金币 0.25
当前主题已经存档。

arqiu

金虫 (正式写手)


[资源] XML Problem Design Solution (Programmer to Programmer)

by Mitch Amiano
Posted by :: Alexpal | Date :: Jan 22, 2007 01:00:00

XML Problem Design Solution (Programmer to Programmer) by Mitch Amiano, Conrad D'Cruz, Kay Ethier, Michael D. Thomas
Publisher: Wrox (June 13, 2006) | ISBN-10: 0471791199 | PDF | 8,3 Mb | 333 pages

— Offering a unique approach to learning XML, this book walks readers through the process of building a complete, functional, end-to-end XML solution — Featured case study is an online business product catalog that includes reports, data input/output, workflow, stylesheet formatting, RSS feeds, and integration with external services like Google, eBay, and Amazon — The format of presenting a problem and working through the design to come up with a solution enables readers to understand how XML markup allows a business to share data across applications internally or with partners or customers even though they might not use the same applications
You'll learn various resolutions to common business and technology needs that are best solved using XML. Plus, you'll get under the hood of everyday applications and web services and discover how to tackle XML markup. By the end of the book, you will understand how to leverage XML applications in order to build a complete, functional, end-to-end XML solution.
What you will learn from this book
— How to share XML data with both internal and external users — Ways to style XML so that it can be used for browser presentation — Techniques for converting XML content online using XSLT, the XML transformation language — How to search, merge, and transform XML documents — Strategies for designing enterprise solutions using XML, workflow engines, and business process management systems — How to create PDF output and produce RSS feeds
Download from Ftp2Share
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yalefield

金虫 (文坛精英)


★ 一星级,一般

★ ★
sinapdb(金币+2):thanks
AJAX:拥抱JSON,让XML走开
转自www.jialing.net

AJAX(Asynchronous JavaScript and XML)说到底就是一种浏览器异步读取服务器上XML内容的技术。现在的技术凡是跟XML扯上关系,再加上个概念做幌子,就像金装了一样,拽得不行。门外的人看得很是热闹,门里的人摇摇头不外如是。
XML呢,跨平台的新潮语言?其实XML=TXT。XML只是符合很多规范的文本。它本身什么都不是,只是保存字符的文件。而浏览器异步读取的只是服务器上的文本内容,所以在Ajax开发时完全不必拘泥于XML。

•JSON的来历

XML 的作用是格式化数据内容。如果我们不用XML还有什么更好的方法吗?
这个答案是JSON。

介绍JSON之我先介绍一下JavaScript这门脚本语言。脚本语言自身有动态执行的天赋。即我们可以把想要执行的语句放在字符串里,通过eval()这个动态执行函数来执行。字符串里的内容会像我们写的脚本 一样被执行。
示例1:


eval example 1






打开页面会弹出hello窗口。
我们可以在字符串中放任何脚本语句,包括声明语句:


  eval example 2






如果在后台异步传来的文本是JavaScript的声明语句,那么不是一条eval方法就能解析了?对于解析复杂的XML,这样的效率是多么大的提高啊!

现在就来告诉你什么是JSON:JavaScript Object Notation
我更愿意把它翻译为JavaScript对象声明

比如要从后台载入一些通讯录的信息,如果写成XML,如下:

   
        Michael
        17bity@gmail.com
        http://www.jialing.net
   

   
        John
        john@gmail.com
        http://www.john.com
   

   
        Peggy
        peggy@gmail.com
        http://www.peggy.com
   



而写成JSON呢:
[
  {
   name:"Michael",
   email:"17bity@gmail.com",
   homepage:"http://www.jialing.net"
},
{
   name:"John",
   email:"john@gmail.com",
   homepage:"http://www.jobn.com"
},
  {
   name:"Peggy",
   email:"peggy@gmail.com",
   homepage:"http://www.peggy.com"
}
]

简单不只是表达上,最重要的是可以丢弃让人晕头转向的DOM解析了
因为只要符合JavaScript的声明规范,JavaScrip会自动帮你解析好的。

Ajax中使用JSON的基本方法是前台载入后台声明JavaScript对象的字符串,用eval方法来将它转为实际的对象,最后通过 DHTML更新页面信息。

•JSON的格式

JSON的基本格式如下,图片来自json.org:


对象是属性、值对的集合。一个对象的开始于"{",结束于"}"。每一个属性名和值间用":"提示,属性间用","分隔。

数组是有顺序的值的集合。一个数组开始于"[",结束于"]",值之间用","分隔。


值可以是引号里的字符串、数字、true、false、null,也可以是对象或数组。这些结构都能嵌套。


字符串的定义和C或Java基本一致。


数字的定义也和C或Java基本一致。


•JSON VS XML

可读性
JSON和XML的可读性可谓不相上下,一边是建议的语法,一边是规范的标签形式,很难分出胜负。

可扩展性
XML天生有很好的扩展性,JSON当然也有,没有什么是XML能扩展,JSON不能的。

编码难度
XML有丰富的编码工具,比如Dom4j、JDom等,JSON也有json.org提供的工具,但是JSON的编码明显比XML容易许多,即使不借助工具也能写出JSON的代码,可是要写好XML就不太容易了。

解码难度
XML的解析得考虑子节点父节点,让人头昏眼花,而JSON的解析难度几乎为0。这一点XML输的真是没话说。

流行度
XML已经被业界广泛的使用,而JSON才刚刚开始,但是在Ajax这个特定的领域,未来的发展一定是XML让位于JSON。到时Ajax应该变成Ajaj(Asynchronous JavaScript and JSON)了。

附:

JSON.org : http://www.json.org/
JSON in JavaScript : http://www.json.org/js.html
JSON: The Fat-Free Alternative to XML : http://www.json.org/xml.html
JSON and the Dynamic Script Tag: Easy, XML-less Web Services for JavaScript: http://www.xml.com/pub/a/2005/12/21/json-dynamic-script-tag.html
Using JSON (JavaScript Object Notation) with Yahoo! Web Services: http://developer.yahoo.com/common/json.html
2楼2007-01-22 11:19:27
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 arqiu 的主题更新
☆ 无星级 ★ 一星级 ★★★ 三星级 ★★★★★ 五星级
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见