DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> AJAX入門 >> AJAX詳解 >> Ajax 權衡:XML 的多種風格 (9)
Ajax 權衡:XML 的多種風格 (9)
編輯:AJAX詳解     

這是一個相當簡單的從半結構化數據到 HTML 的映射。默認的樣式不太多,但是很容易使用 CSS 以跨平台的方式重新設置樣式。使用 DOM 操作數據也很容易,甚至不需要解釋。添加 Html 代碼會使文檔有所膨脹,但是不太過分。這個示例與 XOXO 大綱微格式非常相似而且我相信,如果在第一個 <ul /> 元素中添加 class="outline",它就會成為 XOXO 大綱。可以使用定制的 XML 語言添加更多的語義內容,例如用 <submission/> 元素替換描述列表,但是對於這個示例,在簡潔性或可讀性方面幫助不大。接下來,我嘗試使用 JavaScript Object Notation(JSON)進一步進行簡化:


清單 4
                

    {   "publisher": "Room of One's Own",
        "type": "Journal",
        "titles": ["Hyacinth Blue", "Fabrication", "Thanksgiving",
            "Spilling the Peas"],
        "titles accepted": ["Hyacinth Blue"],
        "submitted": "2005-05-10",
        "accepted": "2005-09-01",
        "published": "2006-10-01",
        "payment received": "2006-09-01",
        "expenses": [{"postage": "CAD 1.12"}],
        "payment": ["CAD 50.00", "2 CopIEs of Publication Issue"]},
    {   "publisher": "Surrey International Writers' Competition",
        "type": "Contest",
        "titles": ["The Thirteenth Child"],
        "titles accepted": ["The Thirteenth Child"],
        "submitted": "2006-08-31",
        "accepted": "2006-09-26",
        "published": "2006-10-20",
        "payment received": "2006-10-20",
        "expenses": [{"postage": "CAD 1.05"},
            {"postage": "CAD 15.00"}],
        "payment": ["CAD 150.00", "Honorable Mention",
            "Copy of Anthology"]},
    {   "publisher": "Word on the Street",
        "type": "Invited Reader",
        "event": "10 Minutes of readings",
        "event date": "2006-09-24",
        "payment": ["T-Shirt", "Lunch"]},
    {   "publisher": "Paideusis: The Journal of the Canadian\
             Philosophy of Education SocIEty",
        "type": "Refereed Journal",
        "titles": ["To Carry Over: Metaphor Invents Us \
            (seven poems)"],
        "titles accepted": "All",
        "submitted": "2006-10-13",
        "accepted": "2006-10-16",
        "published": "Pending"}
]
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved