Xpath error message "exceptions.ValueError: Invalid XPath:"

Xpath error message "exceptions.ValueError: Invalid XPath:"

我尝试使用 xpath 获取以下 html 代码的 @content 属性:

<meta content="52222" name="DCSext.job_id">

我将此 xpath 代码用作 scrapy spider 的一部分:

    def parse(self, response):
    hxs = HtmlXPathSelector(response)
    sites = hxs.select('//*')    

    for site in sites:
        il = DataItemLoader(response=response, selector=site)
        il.add_xpath('listing_id', 'meta[@name="DCSext.job_id"]@content')
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        il.add_xpath('loc_pj', substring-after('h1[@class="title heading"]/text()',':'))
        il.add_xpath('title', 'head/title/text()')
        il.add_xpath('post_date', 'div[@id="extr"]/div/dl/dd[3]/text()')
        il.add_xpath('web_url', 'head/link[@rel="canon"]@href')
        yield il.load_item()    

我收到下划线代码的错误信息:

 exceptions.ValueError: Invalid XPath:  meta[@name="DCSext.job_id"]@content

如何解决这个问题?非常感谢!

正确的代码应该是:

meta[@name="DCSext.job_id"]/@content
                           ^