xmltable能不能解析具有命名空间的xml数据,比如
Select *
From xmltable('$B/ClinicalDocument/title' passing ---这里指定根节点
xmltype('<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<title>检查报告</title></ClinicalDocument>') As B columns Name Varchar2(200) path '/title');
这样写,数据不能解析出来
<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<realmCode code="CN"/>
<typeId root="2.16.840.1.113883.1.3" extension="POCD_MT000040"/>
<templateId root="2.16.156.10011.2.1.1.26" extension="04B026949C004FE39C555A6C3602A1BC"/>
<id root="2.16.156.10011.1.1" extension="urn:uuid:89e71650-9ee8-4668-9119-3d0bd2972f32"/>
<code code="C0006" codeSystem="2.16.156.10011.2.4" codeSystemName="卫生信息共享文档规范编码体系" displayName="检查报告"/>
<title>检查报告</title>
<effectiveTime value="20171011083455"/>
<confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25" codeSystemName="Confidentiality" displayName="正常访问保密级别"/>
<languageCode code="zh-CN"/>
<setId/>
<versionNumber value="1"/>
<recordTarget typeCode="RCT" contextControlCode="OP">
<patientRole classCode="PAT">
<id root="2.16.156.10011.1.11" extension="1003170095"/>
<id root="2.16.156.10011.1.33" extension="1054740"/>
<id root="2.16.156.10011.1.24" extension="37230928"/>
<patientType>
<patienttypeCode codeSystem="2.16.156.10011.2.3.1.271" codeSystemName="患者类型代码表" code="01" displayName="门诊"/>
</patientType>
<addr use="H">
<houseNumber>竹马村02组</houseNumber>
<streetName>回隆彝族乡</streetName>
<county>石棉县</county>
<city>雅安市</city>
<state>四川省</state>
<postalCode/>
</addr>
<telecom value="8866482"/>
<patient classCode="PSN" determinerCode="INSTANCE">
<id root="2.16.156.10011.1.3" extension="511824200910183830"/>
<name>张竣一</name>
<administrativeGenderCode codeSystem="2.16.156.10011.2.3.3.4" codeSystemName="生理性别代码表(GB/T 2261.1)" code="1" displayName="男性"/>
<birthTime value="20091018"/>
<maritalStatusCode codeSystem="2.16.156.10011.2.3.3.5" codeSystemName="婚姻状况代码表(GB/T 2261.2)" code="10" displayName="未婚"/>
<age unit="岁11月" value="7"/>
<employerOrganization>
<name/>
<telecom value=""/>
<addr use="WP">
<houseNumber/>
<streetName/>
<county/>
<city/>
<state/>
<postalCode/>
</addr>
</employerOrganization>
</patient>
<providerOrganization classCode="ORG" determinerCode="INSTANCE">
<id root="2.16.156.10011.1.5" extension="45256407-7"/>
<name>石棉县人民医院</name>
</providerOrganization>
</patientRole>
</recordTarget>
<author typeCode="AUT" contextControlCode="OP">
<time value="20171011"/>
<assignedAuthor classCode="ASSIGNED">
<id root="2.16.156.10011.1.7" extension="45256407-7.3562"/>
<assignedPerson>
<name>张晓琴</name>
</assignedPerson>
</assignedAuthor>
</author>
<custodian typeCode="CST">
<assignedCustodian classCode="ASSIGNED">
<representedCustodianOrganization classCode="ORG" determinerCode="INSTANCE">
<id root="2.16.156.10011.1.5" extension="4525640702"/>
<name>CDR</name>
</representedCustodianOrganization>
</assignedCustodian>
</custodian>
<legalAuthenticator>
<time value="20171011083455"/>
<signatureCode/>
<assignedEntity>
<id root="2.16.156.10011.1.4" extension="45256407-7.179"/>
<code displayName="审核医师"/>
<assignedPerson classCode="PSN" determinerCode="INSTANCE">
<name>刘涛</name>
</assignedPerson>
</assignedEntity>
</legalAuthenticator>
<authenticator>
<time value="20171011083504"/>
<signatureCode/>
<assignedEntity>
<id root="2.16.156.10011.1.4" extension="45256407-7.3563"/>
<code displayName="检查技师"/>
<assignedPerson classCode="PSN" determinerCode="INSTANCE">
<name>张镇疆</name>
</assignedPerson>
</assignedEntity>
</authenticator>
<authenticator>
<time value="20171010202300"/>
<signatureCode/>
<assignedEntity>
<id root="2.16.156.10011.1.4" extension="45256407-7.3478"/>
<code displayName="检查医师"/>
<assignedPerson classCode="PSN" determinerCode="INSTANCE">
<name>张春慧</name>
</assignedPerson>
</assignedEntity>
</authenticator>
<participant typeCode="PRF">
<time value="20171010202300"/>
<associatedEntity classCode="ASSIGNED">
<scopingOrganization>
<id root="2.16.156.10011.1.26" extension="45256407-7.452"/>
<name>儿科</name>
<asOrganizationPartOf>
<wholeOrganization>
<id root="2.16.156.10011.1.5" extension="45256407-7"/>
<name>石棉县人民医院</name>
</wholeOrganization>
</asOrganizationPartOf>
</scopingOrganization>
</associatedEntity>
</participant>
<relatedDocument typeCode="RPLC">
<parentDocument>
<id/>
<setId/>
<versionNumber/>
</parentDocument>
</relatedDocument>
<componentOf typeCode="COMP">
<encompassingEncounter classCode="ENC" moodCode="EVN">
<effectiveTime value="20171010200559"/>
<location typeCode="LOC">
<healthCareFacility classCode="SDLOC">
<serviceProviderOrganization classCode="ORG" determinerCode="INSTANCE">
<asOrganizationPartOf classCode="PART">
<wholeOrganization classCode="ORG" determinerCode="INSTANCE">
<id root="2.16.156.10011.1.22"/>
<name/>
<asOrganizationPartOf classCode="PART">
<wholeOrganization classCode="ORG" determinerCode="INSTANCE">
<id root="2.16.156.10011.1.21"/>
<name/>
<asOrganizationPartOf classCode="PART">
<wholeOrganization classCode="ORG" determinerCode="INSTANCE">
<id root="2.16.156.10011.1.26" extension="45256407-7.452"/>
<name>儿科</name>
<asOrganizationPartOf classCode="PART">
<wholeOrganization classCode="ORG" determinerCode="INSTANCE">
<id root="2.16.156.10011.1.27"/>
<name/>
<asOrganizationPartOf classCode="PART">
<wholeOrganization classCode="ORG" determinerCode="INSTANCE">
<id root="2.16.156.10011.1.5" extension="45256407-7"/>
<name>石棉县人民医院</name>
</wholeOrganization>
</asOrganizationPartOf>
</wholeOrganization>
</asOrganizationPartOf>
</wholeOrganization>
</asOrganizationPartOf>
</wholeOrganization>
</asOrganizationPartOf>
</wholeOrganization>
</asOrganizationPartOf>
</serviceProviderOrganization>
</healthCareFacility>
</location>
</encompassingEncounter>
</componentOf>
<component>
<structuredBody>
<component>
<section>
<code code="29548-5" displayName="Diagnosis" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<text>肺炎?</text>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE05.01.024.00" displayName="诊断代码" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
<effectiveTime value="20171011"/>
<value xsi:type="CD" codeSystem="2.16.156.10011.2.3.3.11" codeSystemName="ICD-10" code="J18.900" displayName="肺炎"/>
<performer>
<assignedEntity>
<id/>
<representedOrganization>
<name>石棉县人民医院</name>
</representedOrganization>
</assignedEntity>
</performer>
</observation>
</entry>
</section>
</component>
<component>
<section>
<code code="10154-3" displayName="CHIEF COMPLAINT" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<text/>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.01.119.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="主诉"/>
<value xsi:type="ST">无</value>
</observation>
</entry>
</section>
</component>
<component>
<section>
<code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="PROBLEM LIST"/>
<text/>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.01.117.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="症状描述"/>
<effectiveTime>
<low value="20171010202118"/>
<high value="20171013101035"/>
</effectiveTime>
<value xsi:type="ST">肺炎?</value>
</observation>
</entry>
</section>
</component>
<component>
<section>
<code code="47519-4" displayName="HISTORY OF PROCEDURES" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<text/>
</section>
</component>
<component>
<section>
<code code="29545-1" displayName="PHYSICAL EXAMINATION" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<text/>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE02.01.079.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="特殊检查标志"/>
<value xsi:type="ST">F</value>
</observation>
</entry>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE02.10.027.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查方法名称"/>
<value xsi:type="ST">胸部(正位(小儿))</value>
</observation>
</entry>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.30.018.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查类别"/>
<value xsi:type="ST">CR</value>
</observation>
</entry>
<entry>
<organizer classCode="CLUSTER" moodCode="EVN">
<statusCode/>
<component>
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.30.019.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查项目代码"/>
<effectiveTime value="20171011"/>
<value xsi:type="ST">X光照片</value>
<entryRelationship typeCode="COMP">
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.50.134.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="标本类别"/>
<effectiveTime>
<low value="20171010203855"/>
<high value="20171011083455"/>
</effectiveTime>
<value xsi:type="ST">CR</value>
</observation>
</entryRelationship>
<entryRelationship typeCode="COMP">
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.50.135.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="标本状态"/>
<value xsi:type="ST">无</value>
</observation>
</entryRelationship>
<entryRelationship typeCode="COMP">
<observation classCode="OBS" moodCode="EVN">
<code code="DE08.50.027.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="标本固定液名称"/>
<value xsi:type="ST">无</value>
</observation>
</entryRelationship>
</observation>
</component>
</organizer>
</entry>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.30.017.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查结果代码"/>
<value xsi:type="CD" codeSystem="2.16.156.10011.2.3.2.38" codeSystemName="检查(检验)结果代码表" code="2" displayName="异常"/>
</observation>
</entry>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.30.015.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查定量结果"/>
<value xsi:type="REAL"/>
<entryRelationship typeCode="COMP">
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.30.016.00" displayName="检查定量结果计量单位" codeSystemName="卫生信息数据元目录" codeSystem="2.16.156.10011.2.2.1"/>
<value xsi:type="ST"/>
</observation>
</entryRelationship>
</observation>
</entry>
</section>
</component>
<component>
<section>
<code code="其他处置章节" displayName="其他处置章节" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<text/>
<entry typeCode="COMP">
<observation classCode="OBS" moodCode="EVN">
<code code="DE06.00.296.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="诊疗过程描述"/>
<value xsi:type="ST">不详</value>
</observation>
</entry>
</section>
</component>
<component>
<section>
<code code="检查报告" displayName="检查报告" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<text/>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.50.131.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查报告结果-客观所见"/>
<value xsi:type="ST">无</value>
</observation>
</entry>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE04.50.132.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查报告结果-主观提示"/>
<value xsi:type="ST">无</value>
</observation>
</entry>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE08.10.026.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查报告科室"/>
<value xsi:type="ST">放射科</value>
</observation>
</entry>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE08.10.013.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查报告机构名称"/>
<value xsi:type="ST">石棉县人民医院</value>
</observation>
</entry>
<entry>
<observation classCode="OBS" moodCode="EVN">
<code code="DE06.00.179.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="检查报告备注"/>
<value xsi:type="ST">设备:妇幼dr</value>
</observation>
</entry>
</section>
</component>
</structuredBody>
</component>
</ClinicalDocument>
因看不到xmltable的内部代码逻辑,无法得知原因;
但是此问题可以确认为:
ORACLE 的XMLTABLE无法解析标签中有默认命名空间的文件(例如:xmlns="http://......")这样就无法解析;
只要将这个默认的xmlns置换成自定义的命名空间即可解析:(例如:xmlns:xls="http://......")这样就可以解析了;