'XinXii\'s open search url is:
http://www.xinxii.com/catalog-search/query/?keywords={searchTerms}&amp;pw={startPage?}&amp;doc_lang={docLang}&amp;ff={docFormat},{docFormat},{docFormat}
This url requires the docLang and docFormat. However, the search itself
sent to XinXii does not require them. They can be ignored. We cannot
push this into the stanard OpenSearchOPDSStore search because of the
required attributes.
XinXii doesn\'t return all info supported by OpenSearchOPDSStore search
function so this one is modified to remove parts that are used.'

def search(self, query, max_results=10, timeout=60):

    url = (u'http://www.xinxii.com/catalog-search/query/?keywords=' + urllib.quote_plus(query))
    counter = max_results
    br = browser()
    with closing(br.open(url, timeout=timeout)) as f:
        doc = etree.fromstring(f.read())
        for data in doc.xpath(u'//*[local-name()    =    "entry"]'):
            if (counter <= 0):
                break
            counter -= 1
            s = SearchResult()
            s.detail_item = u''.join(data.xpath(u'./*[local-name()    =    "id"]/text()')).strip()
            for link in data.xpath(u'./*[local-name()    =    "link"]'):
                rel = link.get(u'rel')
                href = link.get(u'href')
                type = link.get(u'type')
                if (rel and href and type):
                    if (rel in (u'http://opds-spec.org/thumbnail', u'http://opds-spec.org/image/thumbnail')):
                        s.cover_url = href
                    if (rel == u'alternate'):
                        s.detail_item = href
            s.formats = u'EPUB,    PDF'
            s.title = u'    '.join(data.xpath(u'./*[local-name()    =    "title"]//text()')).strip()
            s.author = u',    '.join(data.xpath(u'./*[local-name()    =    "author"]//*[local-name()    =    "name"]//text()')).strip()
            price_e = data.xpath(u'.//*[local-name()    =    "price"][1]')
            if price_e:
                price_e = price_e[0]
                currency_code = price_e.get(u'currencycode', u'')
                price = u''.join(price_e.xpath(u'.//text()')).strip()
                s.price = ((currency_code + u'    ') + price)
                s.price = s.price.strip()
            (yield s)
