日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
詳細闡述JSON序列化的進行轉換介紹

將數(shù)據(jù)從一種格式轉換成另一種格式總是一個很困難的任務。將 Atom 這樣豐富和強大的數(shù)據(jù)格式序列化為 JSON 這類簡單的基本格式,一定會面臨許多問題,本文描述的技術只是其中的一種。

在平城等地區(qū),都構建了全面的區(qū)域性戰(zhàn)略布局,加強發(fā)展的系統(tǒng)性、市場前瞻性、產品創(chuàng)新能力,以專注、極致的服務理念,為客戶提供做網(wǎng)站、網(wǎng)站設計 網(wǎng)站設計制作按需定制,公司網(wǎng)站建設,企業(yè)網(wǎng)站建設,品牌網(wǎng)站制作,成都全網(wǎng)營銷,成都外貿網(wǎng)站建設,平城網(wǎng)站建設費用合理。

忽略所有擴展,而且不要將它們包含在 JSON 序列化中 序列化已知擴展,忽略其他所有擴展 序列化所有擴展 第一種選擇顯然是最簡單的選擇,但是限制了 JSON 表示的整體效用(并不一定是件壞事)。第二種選擇允許對已知擴展的 JSON 序列化進行優(yōu)化和簡化。#t#

將 Atom 序列化為 JSON 需要考慮的最后一個問題是,如何處理擴展。有 3 種可能的選擇:但是仍然限制了序列化的效用。第三種選擇顯著增加了序列化的總體復雜性,但是能夠確保原始 Atom 文檔的所有信息都能夠通過 JSON 表示出來。

首先討論如何優(yōu)化已知擴展的輸出。Atom Threading Extension (RFC 4685) 提供了一種方法,可以表示某個條目是另一個條目的響應。主題擴展規(guī)范明確指定了 in-reply-to 元素的屬性和含義,并表示多個 in-reply-to 元素可以出現(xiàn)在同一個條目中。了解了這一點,就可以對 in-reply-to 元素的 JSON 表示進行優(yōu)化,如清單 26 和 27 所示。

 
 
  1.   ...   ref="tag:example.org,2007:/foo/entries/2" />
  2.    ref="tag:example.org,2007:/foo/entries/3" />  ... 

文檔轉換

現(xiàn)在,可以獲取任何 Atom 文檔并將其轉換為有用的JSON 序列化。清單 30 和 31 提供了轉換過程的完整演示。原始 Atom 文檔包含相對 IRI、語言上下文、擴展、多種文本和內容類型等。使用從 Internet 上獲得的任何 XML 和 JSON 轉換器運行此文檔,產生的序列化都不可避免地遇到數(shù)據(jù)丟失和/或可用性問題。

 
 
  1.  version="1.0" encoding="utf-8" ?>  xmlns:a="http://www.w3.org/2005/Atom"    
  2.      xmlns:thr="http://purl.org/syndication/thread/1.0"      
  3.    xmlns="http://www.w3.org/1999/xhtml"      
  4.    xmlns:foo="http://example.org/unknown-markup"       
  5.   xml:lang="en-US"         xml:base="http://example.org/foo"     
  6.     dir="ltr">     tag:example.org,2007:/foo  
  7.  Example Feed    type="html">This is an example feed

    ]]>
     
  8.    type="xhtml">    
          

    Copyright ? James M Snell

      
  9.   
      xmlns="http://www.w3.org/2005/Atom">    
  •  James M Snell     jasnell@example.org    
  •  /~jasnell      2007-10-14T12:12:12Z  
  •   rel="self" href="" />    href="/blog" />    rel="alternate" 
  • type="application/json" href="/blog;json" />      xml:base="entries/1">     
  • tag:example.org,2007:/foo/entries/1      type="text">Entry Number One  
  •     type="xhtml">       
             

    This is the first entry. You can read it  href="">here

      
  •      
  •            type="html">      

    Copyright © James M Snell

          
  •    2007-10-14T12:12:12Z      href="" />  
  •     rel="alternate" type="application/json" href="1;json" />   
  •    rel="replies" type="application/atom+xml"     
  •   href="1;replies" thr:count="10" />      type="xhtml">    
  •    
             

    This is the content of the first entry. It contains a picture.

         
  •      src="/images/foo.jpg" />       
  •        
  •     ref="tag:example.org,2007:/foo/entries/2" />     
  •  scheme="http://example.org/categories/" term="foo"      
  •  label="test" xml:lang="en-US" />      scheme="http://example.org/categories/" term="bar"  
  •      label="essai" xml:lang="fr" />      d="e">f  
  •       xml:base="entries/2" xml:lang="fr">     tag:example.org,2007:/foo/entries/2   
  •    type="text">La première entrée      type="xhtml">       
           
  •   

    Il s''agit de la première entrée. Vous pouvez lire          href="">est ici

         
  •   
  •            type="html">      

    Copyright © James M Snell

      
  •        2007-10-14T12:12:11Z      href="" />   
  •    rel="alternate" type="application/json" href="2;json" />      rel="replies" type="application/atom+xml"     
  •   href="2;replies" thr:count="10" />      type="xhtml">       
          
  •    

    Ceci est le contenu de la première entrée. Il contient une image.

          
  •     src="/images/foo.jpg" />       
  •          
  •  scheme="http://example.org/categories/" term="foo"  
  •      label="test" xml:lang="en-US" />      scheme="http://example.org/categories/" term="bar" 
  •       label="essai" xml:lang="fr" />      d="e">f     
  • 本文描述的從 Atom 到 JSON 的序列化技術能夠生成一個容易理解、易于使用而且能夠避免丟失重要上下文數(shù)據(jù)的 JSON 表示。清單 31. 對清單 30 中完整的 Atom 提要文檔進行 JSON 序列化

    使用 Abdera JSON Writer

    本文介紹的技術已經作為 Apache Abdera 項目的一部分實現(xiàn)了。清單 32 中的代碼演示了 Abdera JSON Writer 的使用。如果想要嘗試 Atom 到 JSON 的轉換,請訪問 Abdera wiki,獲取關于如何下載最新開發(fā)映像的信息。

    結束語

    將數(shù)據(jù)從一種格式轉換成另一種格式總是一個很困難的任務。將 Atom 這樣豐富和強大的數(shù)據(jù)格式序列化為 JSON 這類簡單的基本格式,一定會面臨許多問題。盡管已經有許多出色的嘗試,在出現(xiàn)標準的轉換方法之前,應用程序開發(fā)人員需要處理多種質量參差不齊的不兼容序列化方法,本文描述的技術只是其中的一種。


    本文名稱:詳細闡述JSON序列化的進行轉換介紹
    文章轉載:http://www.5511xx.com/article/dhhdseg.html