以下是使用XMLTYPE验证PL_SQL中的xml文件的代码
doc := dbms_xmldom.newdomdocument;
... xml file is build
v_xml:=DBMS_XMLDOM.GETXMLTYPE(doc);
v_schema:=v_xml.createSchemaBasedXML('xml.xsd');
BEGIN
v_schema.schemavalidate();
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('XML File is not valid');
END;
有没有办法知道文件无效的位置,哪个节点?
谢谢
注意:隐藏在这个方面的异常就是这个:
ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00333: literal "" is not valid with respect to the pattern