将clob转换为xml解析错误

时间:2018-01-05 15:01:32

标签: xml plsql clob

我试图将clob转换为xml。我收到以下错误:

enter image description here

ORA-31011:XML解析失败 ORA-19202:XML处理发生错误 LPX-00601:无效令牌:' / KrediBilgi /'

程序:

procedure parse_xml(response in CLOB) is
    l_xmlType XMLTYPE;
  begin
   l_xmlType := XMLTYPE.CreateXML(response); 
   FOR r IN (
    SELECT ExtractValue(Value(p),'/KrediBilgi/Durum/text()') as durum
      ,ExtractValue(Value(p),'/KrediBilgi/GuncelRisk/text()') as risk
      ,ExtractValue(Value(p),'/KrediBilgi/GuncelRiskTarih/text()') as tarih
      ,ExtractValue(Value(p),'/KrediBilgi/KrediHesapNo/text()') as hesapNo
      ,ExtractValue(Value(p),'/KrediBilgi/KrediKod/text()') as krediKod
      ,ExtractValue(Value(p),'/KrediBilgi/KrediKonu/text()') as krediKonu
      ,ExtractValue(Value(p),'/KrediBilgi/KrediTur/text()') as krediTur
      ,ExtractValue(Value(p),'/KrediBilgi/KrediTutar/text()') as krediTutar
      ,ExtractValue(Value(p),'/KrediBilgi/PbKod/text()') as pbKod
      ,ExtractValue(Value(p),'/KrediBilgi/ProjeKod/text()') as projeKod
FROM   TABLE(XMLSequence(Extract(l_xmlType,'/KrediBilgi/'))) p
) LOOP
  dbms_output.put_line(r.durum);
  dbms_output.put_line(r.risk);
  dbms_output.put_line(r.tarih);
  dbms_output.put_line(r.hesapNo);
  dbms_output.put_line(r.krediKod);
  dbms_output.put_line(r.krediKonu);
  dbms_output.put_line(r.krediTur);
  dbms_output.put_line(r.krediTutar);
  dbms_output.put_line(r.pbKod);
  dbms_output.put_line(r.projeKod);
  END LOOP;
 end parse_xml;

1 个答案:

答案 0 :(得分:0)

如果您的xml结构:

FROM   TABLE(XMLSequence(Extract(l_xmlType,'KrediBilgi'))) p

尝试从此行中删除斜杠'/':

'KrediBilgi/Durum/text()'

你也可以从像这样的行中删除第一个斜杠

var mqtt = require('mqtt')

client = mqtt.connect('http://localhost:1883',{clientId :'client1', clean: false});

  client.on('connect', function () {
    client.subscribe('presence',{QoS:2});
    client.subscribe('offline',{QoS:2});
    console.log('connected');
  });
  client.on('message', function (topic, message) {
    console.log(message.toString());
  });