2011-10-23 42 views
0

這裏的主要問題是搜索URL:如何爲GAE文檔創建Firefox搜索插件?

http://code.google.com/intl/it/query/#p=appengine&q=query

它不包含?符號,也有#符號。 這樣的URL沒有通過XML驗證,所以我嘗試了其他方法(甚至包含附加參數),但還沒有找到工作解決方案。

這裏是我目前(圖像部分被截斷的簡化):

<?xml version="1.0" encoding="UTF-8"?> 
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" 
         xmlns:moz="http://www.mozilla.org/2006/browser/search/"> 
    <ShortName>Google AppEngine</ShortName> 
    <Description>Search the GAE documents at Google Code website.</Description> 
    <InputEncoding>UTF-8</InputEncoding> 
    <Image width="16" height="16" type="image/x-icon">data:image/x-icon;base64,...</Image> 
    <Url type="text/html" method="GET" template="http://code.google.com/intl/it/query/#p=appengine"> 
    <Param name="a" value="{moz:locale}"/> 
    <Param name="q" value="{searchTerms}"/> 
    </Url> 
    <moz:SearchForm>http://code.google.com/intl/it/appengine/docs/</moz:SearchForm> 
</OpenSearchDescription> 

回答

1

使用實體&amp;來編碼&,以及XML將是有效的:

<?xml version="1.0" encoding="UTF-8"?> 
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" 
         xmlns:moz="http://www.mozilla.org/2006/browser/search/"> 
    <ShortName>Google AppEngine</ShortName> 
    <Description>Search the GAE documents at Google Code website.</Description> 
    <InputEncoding>UTF-8</InputEncoding> 
    <Image width="16" height="16" type="image/x-icon">data:image/x-icon;base64,25</Image> 
    <Url type="text/html" method="GET" template="http://code.google.com/intl/it/query/#p=appengine&amp;q={searchTerms}"></Url> 
    <moz:SearchForm>http://code.google.com/intl/it/appengine/docs/</moz:SearchForm> 
</OpenSearchDescription> 

拷貝XML至http://validator.w3.org/check以確認有效性。