【发布时间】:2014-08-14 12:10:28
【问题描述】:
xml 看起来像这样:
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<BlockUpload xmlns="http://mftsolutions.com/">
<data><Block xmlns="http://mftsolutions.com/BlockUploader/Block"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mftsolutions.com/BlockUploader/Block BlockSchema.xsd">
<Header>
<Identifier>ID10567</Identifier>
</Header>
</Block></data>
</BlockUpload>
</soap12:Body>
</soap12:Envelope>
我想获取元素标识符(ID10567)的值。
我尝试了一些这样的查询,但没有结果。可能我在 xmlNamespaces 声明中遗漏了一些东西:
select h_id
from test_xml,
xmltable(xmlNamespaces ( default 'http://mftsolutions.com/BlockUploader/Block'
,'http://mftsolutions.com/' as "mft"
,'http://www.w3.org/2001/XMLSchema-instance' as "xsi"
,'http://www.w3.org/2001/XMLSchema' as "xsd"
,'http://www.w3.org/2003/05/soap-envelope' as "soap12"),
'//soap12:Envelope/soap12:Body/BlockUpload/data/Block/Header'
PASSING XMLTYPE(xml)
COLUMNS
h_id VARCHAR2(1000) PATH 'Identifier')
我错过了什么?
此查询的示例表:
create table test_xml (xml clob);
insert into test_xml values ('<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<BlockUpload xmlns="http://mftsolutions.com/">
<data><Block xmlns="http://mftsolutions.com/BlockUploader/Block"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mftsolutions.com/BlockUploader/Block BlockSchema.xsd">
<Header>
<Identifier>ID10567</Identifier>
</Header>
</Block></data>
</BlockUpload>
</soap12:Body>
</soap12:Envelope>');
【问题讨论】:
标签: xml oracle soap xml-namespaces xmltable