MYSQL extractValue一起
问题描述:
我有以下XMLMYSQL extractValue一起
<ns8:vehicles>
<ns8:vehicle vinNumber="asdaqwe" model="lambda" make="xdeee">
<ns8:registration number="e123asdz23" date="2016-07-22"/>
<ns8:usage type="Passenger"/>
</ns8:vehicle>
</ns8:vehicles>
,并试图让元素vinNumber和查询 使用extractValue和注册号,所以我做这样的事情:
select ExtractValue(databasexmlfield, '//ns8:vehicle//ns8:registration')
select ExtractValue(databasexmlfield, '//ns8:vehicle//ns8:registration number')
select ExtractValue(databasexmlfield, '//ns8:vehicle//ns8:registration::number')
没有这些作品返回xpath错误或返回0数据。 我如何得到这个工作?
当XML呈现像它的工作:
<holder id="1">
<title>Mr</title>
所以当我输入选择extractValue一起(databasexmlfield, '// //持有标题') 它打印先生 MySQL的版本是最新的5.5
答
尝试:
SELECT
ExtractValue(@`xml`, '//ns8:vehicle/attribute::vinNumber'),
ExtractValue(@`xml`, '//ns8:vehicle/ns8:registration/attribute::number');