我正在尝试在 Oracle 10g 中提取具有名称空间的标记的值。我的查询是
select extract(xmltype(xml_text),
'/feed/entry[1]/yt:statistics',
'xmlns:yt="http://gdata.youtube.com/schemas/2007"') title
from edgecast_xml
where load_date > sysdate-1
它返回 null
原始 xml 是这样的(我不得不将其标记为 htp 而不是 http 以避免链接):
<feed xmlns='htp://www.w3.org/2005/Atom' xmlns:media='htp://search.yahoo.com/mrss/' xmlns:openSearch='htp://a9.com/-/spec/opensearch/1.1/' xmlns:gd='htp://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007' gd:etag='W/"D0YEQH88eSp7I2A9XRZQEU8."'>
<entry gd:etag='W/"CUMNRH47eCp7I2A9XRZRGUo."'>
<id>tag:youtube.com,2008:video:qXPtXPJLnJY</id>
<updated>2014-06-17T02:51:35.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/>
<category scheme='http://gdata.youtube.com/schemas/2007/categories.cat' term='Nonprofit' label='Nonprofits & Activism'/>
<title>Rear Admiral Lee Addresses Restrictive Regulations on Religious Liberty</title>
<gd:rating average='4.8343196' max='5' min='1' numRaters='5239' rel='http://schemas.google.com/g/2005#overall'/>
<yt:statistics favoriteCount='0' viewCount='365565'/>
<yt:rating numDislikes='217' numLikes='5022'/>
</entry>
</feed>
为什么我会为空?如果我只选择 /feed/entry[1] 它会为 entry 标记中的所有内容返回 xml。