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>');