Oracle
 sql >> Datenbank >  >> RDS >> Oracle

Analysieren von XML-Kommentaren in Oracle

Eine Kombination aus replace , extract und und xpath-Ausdrücke könnten Folgendes tun:

select 
replace(replace(
extract(
xmltype (q'{<?xml version="1.0" encoding="utf-8"?> 
<!--ADOR Acknowledgement 2-->  
<AckTransmission xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.irs.gov/efile">
<TransmissionHeader recordCount="1">  
<Jurisdiction>ALABAMA</Jurisdiction>  
<TransmissionId>1946157056</TransmissionId>    
<Timestamp>2012-08-16T01:25:47-05:00</Timestamp> 
<Transmitter>      
  <ETIN>00000</ETIN>     
</Transmitter>  
<ProcessType>T</ProcessType>  
<AgentIdentifier>ACK</AgentIdentifier> 
</TransmissionHeader> 
<Acknowledgement> 
  <SubmissionId>X1684956672</SubmissionId> 
  <EFIN>X16849</EFIN>  
  <GovernmentCode>ALST</GovernmentCode> 
  <SubmissionType>XMLTOM</SubmissionType>
  <TaxYear>9999</TaxYear>  
  <SubmissionCategory>MFET</SubmissionCategory>   
  <AcceptanceStatus>A</AcceptanceStatus>  
  <ContainedAlerts>0</ContainedAlerts>    
  <StatusDate>2012-08-16</StatusDate>   
</Acknowledgement> 
</AckTransmission>}'),
'/descendant::comment()'
), '<!--'), '-->') as comment_
from dual;