Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ORA-31011:XML解析失败_Xml_Oracle - Fatal编程技术网

ORA-31011:XML解析失败

ORA-31011:XML解析失败,xml,oracle,Xml,Oracle,错误 以下是我的XML: 您发布的示例数据正常: ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00007: unexpected end-of-file encountered ORA-06512: at "SYS.XMLTYPE", line 272 ORA-06512: at line 1 31011. 00000 - "XML parsing fai

错误

以下是我的XML:


您发布的示例数据正常:

ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00007: unexpected end-of-file encountered
ORA-06512: at "SYS.XMLTYPE", line 272
ORA-06512: at line 1
31011. 00000 - "XML parsing failed"
*Cause: XML parser returned an error while trying to parse the document.
*Action: Check if the document to be parsed is valid.
但表中其他行可能不是这样。例如:

SQL> with test (col) as
  2    (select '
  3      <company>
  4        <employee>
  5          <empno>7839></empno>
  6          <ename>king</ename>
  7          <hiredate>1981-11-17</hiredate>
  8          <sal>5000</sal>
  9          <deptno>10</deptno>
 10          <dname>accounting</dname>
 11        </employee>
 12      </company>'
 13     from dual
 14    )
 15  select xmltype(col) From test;

XMLTYPE(COL)
--------------------------------------------------------
<company>
  <employee>
    <empno>7839&gt;</empno>
    <ename>king</ename>
    <hiredate>1981-11-17</hiredate>
    <sal>5000</sal>
    <deptno>10</deptno>
    <dname>accounting</dname>
  </employee>
</company>


SQL>

如何找到罪犯?一种简单但可能不是很有效的方法是在表中循环并分别对每一行应用XMLTYPE。一旦出现错误,请显示内容并检查问题所在。

该列中的内容很可能不是有效的XML文档。请将您的问题包含在clob_内容列中的XML内容。不要将任何代码作为图像添加到您的问题中,将代码添加到问题本身。感谢您的回答,实际上是XMLTYPE支持文件直到4gb如果文件限制增加4gb,我们如何处理该文件?我不知道,抱歉。你有这么大的文件吗,还是你只是好奇?其实我好奇是因为它的电信数据
SQL> with test (col) as
  2    (select '
  3      <company>
  4        <employee>
  5          <empno>7839></empno>
  6          <ename>king</ename>
  7          <hiredate>1981-11-17</hiredate>
  8          <sal>5000</sal>
  9          <deptno>10</deptno>
 10          <dname>accounting</dname>
 11        </employee>
 12      </company>'
 13     from dual
 14    )
 15  select xmltype(col) From test;

XMLTYPE(COL)
--------------------------------------------------------
<company>
  <employee>
    <empno>7839&gt;</empno>
    <ename>king</ename>
    <hiredate>1981-11-17</hiredate>
    <sal>5000</sal>
    <deptno>10</deptno>
    <dname>accounting</dname>
  </employee>
</company>


SQL>
SQL> with test (col) as
  2    (select '
  3      <company>
  4        <employee>
  5          <empno>7839></empno>
  6          <ename>king<ename>                --> wrong closing tag
  7          <hiredate>1981-11-17</hiredate>
  8          <sal>5000</sal>
  9          <deptno>10</deptno>
 10          <dname>accounting</dname>
 11        </employee>
 12      </company>'
 13     from dual
 14    )
 15  select xmltype(col) From test;
ERROR:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00225: end-element tag "employee" does not match start-element tag "ename"
Error at line 10
ORA-06512: at "SYS.XMLTYPE", line 310
ORA-06512: at line 1



no rows selected

SQL>